I have two bottom left (<) side button and right (>) button. I have to change the images from array with left and right button action?
How do I manage an array index?
I have two bottom left (<) side button and right (>) button. I have to change the images from array with left and right button action?
How do I manage an array index?
I have a tab bar controller with the first view (index 0) having a segue to another view (but stays on index 0 of the tab bar). In this segued view, I have a "Back" button which I want to return to the original view at index 0 when selected. However, when I use:
self.tabBarController?.selectedIndex = 0
I remain on the current segued view. I know it should work because if I change the index to 1 or 2 then it switches to the other views. Also, from the segued view, if I click on the tab bar icon for index 0 (which is the one already highlighted/selected) it does exactly what I want and brings me back to the original view from the segued view. So how do I get my button to do exactly what the tab bar does when I select the already highlighted/selected index?
I have three view controllers: A login view, a home tableview screen, and a detail tableview screen. These are all part of the same UINavigationController. On the home screen, I want to disable the back button, preventing a user from backing into the login screen. So in the viewDidLoad()
function I have
// Home View
override func viewDidLoad() {
super.viewDidLoad()
self.navigationItem.hidesBackButton = true
...
}
When this view shows up, there is no back arrow but there is the word "Back." This button does nothing, it seems disabled. When I go to the next view (the detail view), the back button is hidden. Even if I add a hidesBackButton = false
to the viewDidLoad
of this view, still nothing. However, the swipe to the right on the navigation bar allows going back.
Now that I am back on the home screen, the back button is completely hidden. If I were to then proceed forward again to the detail view, the back button appears as desired.
Here's the Sequence of Events:
Hi I am trying to get a read a property(NSDictionary
) of an objective-c class from a swift class. When I debug the code at the point where the dictionary is passed it has the data I'm expecting, but when the swift code comes into place all I'm getting is this:
{
[0] = {
key = 0x00007ffae0f8bf10
value = 0x00007ffae0f8bf30
}
[1] = {
key = 0x00007ffae0f8ba10
value = 0x00007ffae0f8ae40
}
[2] = {
key = 0x00007ffae0f8bf50
value = 0x0000000105277ce0
}
[3] = {
key = 0x00007ffae0f8b1e0
value = 0x0000000105277ce0
}
[4] = {
key = 0x00007ffae0f8b160
value = 0x0000000105278420
}...
Is there any speech recognition library for Mandarin language in iOS? Any idea? I was seeing OpenEars,iSpeech,Dragon Mobile but don't know how to use it and how to use it supports Mandarin. Is Anyone has tutorial???
on Platform iOS
Thanks,
I have been using this method to show and hie the navbar in my app:
-(void)viewWillAppear:(BOOL)animated{
[super viewWillAppear:animated];
[self.navigationController setNavigationBarHidden:YES]; //it hides
}
The only issue is I want to use this method in a view controller that also uses the below method which dispatches some session quest to an avcam session.
- (void)viewWillAppear:(BOOL)animated
So the thing is when i try to implement the first method I get an error. Should I make this a public class or something? How can I had a view controller using the above method considering the fact there is a copy of the same message name in the file its in.
A general design question. Is it a good design to have a table view controller for the first view, in which all the view controllers of a tab bar will be presented ? Or is it a good design to have a table view controller as the first controller in the tab bar, in which all the view controllers will be presented? Thanks for your answer.
I'm trying to have a UIView.transitionFromView animation between two UIImageViews, but i just cant get it right.
I checked this thread and did exactly as it told (as you can see in my code). I also checked some other threads and discussions on the web, but one of the two things happen -
when i do what the person in the link i provided does, the animation happens on the entire UIView of the VC, and not just for both the views i want to flip between.
when i put them both inside a container UIView, i get no 'flipping' animation - when the duration expires the things swap and that's it.
The relevant code - this is the version without the container, the one that 'flips' the entire superview of both of them (but only the relevant views 'change', the rest of the view just participates in the animation...)
var opponentCardView = self.opponentCards[self.opponentCards.count - 1]
var animalBackView =
UIImageView(image: UIImage(named: self.opponentAnimal.rawValue))
var cardCenter = opponentCardView.center
var cardWidth = opponentCardView.frame.width
var cardHeight = opponentCardView.frame.height
animalBackView.frame = CGRectMake(cardCenter.x - cardWidth / 2,
cardCenter.y - cardHeight / 2, cardWidth, cardHeight)
self.gameView.addSubview(animalBackView)
UIView.transitionFromView(opponentCardView, toView: animalBackView, duration: 1.0,
options: UIViewAnimationOptions.TransitionFlipFromLeft, completion: nil)
please help me solve this, have no idea what is happening. Thanks alot!
I'm having a weird problem that is similar to this post or this question. My toolbar's far left bar button item's touch censor is off place. In my case this only happens when I add toolbar in DetailViewController in SplitViewController and run it on the iPhone.
Red field is the off place touch censor for the item button.
I've tried many things and those are the things that I found out. I'm using Xcode 6.
Has anyone had the same problem before? If not, I would very much appreciate it if you could try it yourself by simply creating a new Master-Detail project and add toolbar in DetailViewController and constrain it to the bottom and run it on the iPhone simulator or a device. Please share if it causes a same problem. There doesn't seem to be any clear answer to this so I'm wondering if there's a issue with the Xcode. Only solution I came up with is to use tab bar instead. Please share your thoughts or solution on this.
Edit:
I've connected the Item button to IBAction and it does get triggered when I touch on Item. I thought it was not working because it doesn't give the flash animation unless I touch the red field. IBAction gets called but it still doesn't give the flash animation unless I touch on the red field. And touch censor field for the item button seems too large.
I've never built an iOS app, so I need some feedback on the following.
When building your app do you create an objective c class to model the table that you have in your relational database? So lets say I have this table:
Todo Item
- title
- completed
Would I create an objective c class that looks like this
@interface TodoItem : NSObject
@property NSString *title;
@property BOOL completed;
@end
Do any validation required then create my request url from my objective c class?
POST: http://ift.tt/1zsg6AN
To create my item on my database?
I've had my Google Analytics account linked to my YouTube channel for some time now, but the one thing I can't seem to get data from is when a user visits my YouTube channel using their iPhone/Android YouTube app.
It will track it as a mobile visit if they open YouTube through the internet browser on their phone, but not the actual YouTube App. I've confirmed this by testing it on my own phone (with no filter to exclude the IP address).
Does anyone know if there's a way to do this? Perhaps I have my Google Analytics account set up incorrectly, or am missing something obvious?
I appreciate any help. Thanks.
I am designing a basic app for a local business, and am trying to find a way to make a Button open up the Apple Maps App to a pre-determined Address. All of my efforts thus far have not been fruitful. What would be the easiest and most efficient way to do this?
Thanks
I cannot figure out how to load my textures in a brief few seconds. It is taking a monster 20+ seconds.
Initially I had my animations in separate texture atlases. They are named something like sprite_002@2x~iphone.png
. When they were separate I used code similar to that in the Apple documentation:
SKTextureAtlas *atlas = [SKTextureAtlas atlasNamed:@"monster"];
SKTexture *f1 = [atlas textureNamed:@"monster-walk1.png"];
SKTexture *f2 = [atlas textureNamed:@"monster-walk2.png"];
SKTexture *f3 = [atlas textureNamed:@"monster-walk3.png"];
SKTexture *f4 = [atlas textureNamed:@"monster-walk4.png"];
NSArray *monsterWalkTextures = @[f1,f2,f3,f4];
My code was:
let names = myAtlas.textureNames as [String];
for name in names {
myTextureArray.append(myAtlas.textureNamed(name as String));
}
For 6 animations in 6 different texture atlases w/ 250 frames each, it took about 6 seconds to load.
I was able to eliminate 60-70% of those frames and cram everything into a single texture atlas, but now I cannot get it to load in a reasonable time frame.
I have been trying code along these lines:
for i in 1...124 {
let name = String(format: "sprite_%03d", i);
let texture = imagesAtlas.textureNamed(name);
spriteTextures.append(texture);
}
Most games iPhone games don't have a 20 second load time, so I know I am doing something wrong here.
i'll preface by saying i'm less than a month into programming with swift. so i've still heavy in the learning phase and much of the stuff online i've search has been written in Objective-C.
my problem right now is that, I have been using a CA Layer to display images. (i want to use CA layers because of the animating properties they have that I plan to utilize)
the layer is itself is connect with my UIView like this:
@IBOutlet weak var myView: UIView!
var l: CALayer {
return myView.layer
}
now i have set the UIView in storyboard something like x:100, y:100, w:100, h:100.
but instead of a 100x100 square to put my image into. I want a polygon shape that I can custom draw with bezier points.
how can i draw the bezier path and set the frame/bound? of the UIView to this custom bezier shape?
this is my first post. i hope that i phrased this question right and didn't overlook any obvious solutions.
Hi I am working on an application in which I have to recognize the tap on back cover or side of the device and perform an action. I have tried the sensors but values are so dynamics that a small tap can not be recognized. Is there any way to recognize the tap. This tap can also be recorded on camera also. Please help. Thanks in advance.
i am newbie to iOS development. i have rails app which i want to put it on iStore first for testing and then to general people. Before I started to ask this question i have checked other relevant question. i have a company developer account. What i did Link which i am referring to there are lot of places where its not clear. Is there step by step guide for whole process. Which can lead me from adding my developer id to Xcode to creating ipa file which i can test on real iOS device. Also how can perform inspect element for iOS devices for my current app. To clarify what I mean by that is if I launch a app on iPhone how can see what are various things happening in regards to this given app, for example What calls its making, which element comes from which css file and so on.
Thanks for advice. Please let me know if I mixed up too many things here.
I am little bit new at facebook api so my question is, Is there anyway to find the latest status of any facebook friend?
Thanks in Advance for any help.
Regards Emon
When I add audio tag to html and try to see it on IPhone 5 it has only half the size. How do I fix it?
<!DOCTYPE html>
<html>
<body>
<audio id="audio" preload="auto" tabindex="0" controls="controls" type="audio/mpeg">
<source type="audio/mp3" src="someSource.mp3">
</audio>
</body>
</html>
If I zoom in then it works. But not in the normal screen.
Wrong:
Expected:
If I add
<meta name="viewport" content="width=device-width, initial-scale=1">
It would also show up properly but would become half height once zoomed out.
I have an NSMutableArray of notifications, each time the view controller is opened, then NSMutableArray gets updated, how do I work out how many new items (notifications) have been added to the NSMutableArray?
NSMutableArray *arrItems;
[SharedDelegate.hnController loadDataOfType:GTUserNotifications cateId:self.strUserId curPage:curPage result:^(NSArray *results, GTControllerType type, BOOL success) {
if (!success)
{
[UIView animateWithDuration:0.5
delay:0.0
options:UIViewAnimationOptionLayoutSubviews | UIViewAnimationOptionAllowUserInteraction
animations:^{
[self.vNoNetWork setFrame:CGRectMake(0, 430, 320, 25)];
// animate here...
}
completion:^(BOOL finished){
}];
//[loading stopAnimating];
[refreshControl endRefreshing];
return;
}
[self.activityIndicatorView setHidden:YES];
[[self footerActivityIndicator] stopAnimating];
[arrItems addObjectsFromArray:results];
NSLog(@"ArrayItems: %@", arrItems);
[self.tblView reloadData];
}];
Thanks in advance
I've build Adobe AIR Flex app that is working on Android in Google Play and on iOS in Apple Store. But on iPhone 5 - the upper right corner buttons are very very hard to click.
The flex application is done well - there is nothing on top of the buttons, and it works perfectly on Android, but on iOS the buttons kind of work after 5-10 times of trying to click them.
Can it be because of the top bar that iPhone can drag down in the native screen ?
Here is my monopoly app on iOS so you can see it for yourself. And here is the monopoly in Google Play - working without problems.
Thanks!
I am using storyboard in my app, I add Facebook framework for integration but when i run my app on device, Xcode quit unexpectedly. It works fine on simulator but not on device. Why it is happening, I am stuck on it. I searched about it but not found any useful result. Please anyone help me.
I am using Xcode 6.1 with storyboard and Facebook - iOS - sdks 3.23.1 pkg.
I have a problem: How can I convert (resolve) an ip address (like www.google.com) into ip address (array of byte)? I tried different code but every time the code crash if the address don't exist. There is a way to check also this? Thank you
Am trying a simple Apple Watch App. the question I have is : will the iPhone App be able to run always in the background? In the App, I want to fetch some files from a server & store them in the iPhone (I want to do this everyday at a specific time), so that when the user opens the Apple Watch App, the file can be showed immediately (and no need to wait for it be downloaded then).
I am using the blur effect on an image view in iOS 8 and I wonder if it's possible to tell swift how strong the blur effect should be.
This is the code..
var blurEffect = UIBlurEffect(style: UIBlurEffectStyle.Dark)
var visualEffectView = UIVisualEffectView(effect: blurEffect) as UIVisualEffectView
visualEffectView.frame = imageView.bounds
imageView.addSubview(visualEffectView)
I am using pouchdb 3.3.0 in my app , its working fine in chrome/firefox/safari on desktop.
but on mobile(ios7) safari i am getting following error while saving doc
{"status":500,"name":"Object","message":"unknown"}
Is it possible to have the UIApplicationUserDidTakeScreenshotNotification running in the background?
i want to pass this data using api plz help me i want to get countryname id,code,but iam not getting how to do can any one help me thanks in advance.
-(void) getContries { // NSDictionary *dict = [[NSDictionary alloc] initWithObjectsAndKeys:nil];
// NSString *token=[[NSUserDefaults standardUserDefaults]objectForKey:@"deviceToken"];
NSString *get=[[NSString alloc]initWithFormat:@"&country_id=%@",[self.countryCode text]];
NSLog(@"%@",get);
NSData *postData = [get dataUsingEncoding:NSASCIIStringEncoding allowLossyConversion:YES];
NSString *postLength = [NSString stringWithFormat:@"%lu", (unsigned long)[postData length]];
NSMutableURLRequest *request = [[NSMutableURLRequest alloc] init];
[request setURL:[NSURL URLWithString:@" http://ift.tt/1N1rk9B"]];
[request setHTTPMethod:@"GET"];
[request setValue:postLength forHTTPHeaderField:@"Content-Length"];
[request setHTTPBody:postData];
NSURLResponse *requestResponse;
NSData *requestHandler = [NSURLConnection sendSynchronousRequest:request returningResponse:&requestResponse error:nil];
NSString *requestReply = [[NSString alloc] initWithBytes:[requestHandler bytes] length:[requestHandler length] encoding:NSASCIIStringEncoding];
NSLog(@"requestReply:%@",requestReply);
}
(IBAction)countryButton:(id)sender {
self.countyPicker.hidden=NO; [self getContries];
} error iam getting:
&country_id= 2015-02-28 11:56:27.186 M_CommerceApplication[1111:39838] requestReply:
I am having an array which contains a date. this is my array.
"2015-03-01",
"2015-03-04",
"2015-03-05",
"2015-03-06",
"2015-03-07",
"2015-03-08",
"2015-03-14",
"2015-03-15"
list the value according to this date.my coding is
NSArray * datevalue = [tempArr valueForKey:@"match_formatted_date"];
NSSortDescriptor *descriptor = [[NSSortDescriptor alloc] initWithKey:@"self" ascending:YES];
NSArray *descriptors = [NSArray arrayWithObject: descriptor];
NSArray *reverseOrder = [datevalue sortedArrayUsingDescriptors:descriptors];
NSPredicate *findFutureDates = [NSPredicate predicateWithBlock: ^BOOL(id obj, NSDictionary *bind){
NSDateFormatter *df = [[NSDateFormatter alloc]init];
[df setDateFormat:@"yyyy-MM-dd"];
[df setTimeZone:[NSTimeZone systemTimeZone]];
NSDate *dd = [df dateFromString:(NSString *)obj ];
return ([[NSDate date] compare:dd] == NSOrderedAscending);
}];
NSArray * arrFutureDates = [reverseOrder filteredArrayUsingPredicate: findFutureDates];
NSLog(@"arrFutureDates:%@",arrFutureDates);
for (id item in arrFutureDates)
{
if (![dataArr containsObject:item])
[dataArr addObject:item];
}
[dataArr sortUsingSelector:@selector(localizedCaseInsensitiveCompare:)];
for (int i= 0; i<[dataArr count]-1; i++) {
for (id item in tempArr)
{
if([@"Mexico: Copa Mexico - Clausura" isEqualToString:[item valueForKey:@"league_name"]]
||[@"Mexico: Liga De Ascenso - Clausura" isEqualToString:[item valueForKey:@"league_name"]]
||[@"Mexico: Primera Division - Clausura" isEqualToString:[item valueForKey:@"league_name"]])
if([[dataArr objectAtIndex:i]isEqualToString:[item valueForKey:@"match_formatted_date"]])
{
NSMutableDictionary *tempDic =[[NSMutableDictionary alloc]init];
[tempDic setValue: [item valueForKey:@"match_formatted_date"] forKey:@"match_formatted_date"];
[tempDic setValue: [item valueForKey:@"league_name"] forKey:@"league_name"];
if (![titleheader containsObject:tempDic])
{
[titleheader addObject:tempDic];
}}}}
my problem is: In title header null value is coming. were I made the mistake, can anyone help me.
I have 10 ios apps which have same UI and almost same functionality except minor changes.
I have completed one app and want to make other 9 app and also used some 3rd party libraries and made changes to them and made some my custom functions for app functionality.
My concern is that if i will get change for even one functionality , i have to make that change to other 9 apps.
What is the the best and fastest way except changing code in each file ?
I am planning to create an app to display an incoming call through notification. The way the app works is, if i am talking to someone through my iPhone to someone else and at the same time someone calls me, I cant receive the other call. So I am planning to create an app for it. Does apple provide the classes for it. I am newbie to XCODE. If i am talking on my phone and I am receiving a call, my app should only give a notification sound.
This app http://ift.tt/OCnqDb lets users login and take and post photos to a stream screen. When the user clicks a photo, a segue is triggered and you see a full size photo.
The app uses a mysql backend. Every user has a Iduser, username, and password. Each photo is in a separate table in the database and is connected to the Iduser that uploaded it, via a php/objective-c/json method combo. The photos are in a table and has an identifier of Idphoto.
When Idphoto is currently clicked this segue is preformed and the user is transitioned to a new viewcontroller that shows the photo fullscreen.
-(void)didSelectPhoto:(PhotoView*)sender {
//photo selected - show it full screen
[self performSegueWithIdentifier:@"ShowPhoto" sender:[NSNumber numberWithInt:sender.tag]];
}
-(void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
if ([@"ShowPhoto" compare: segue.identifier]==NSOrderedSame) {
StreamPhotoScreen* streamPhotoScreen = segue.destinationViewController;
streamPhotoScreen.IdPhoto = sender;
}
}
The above code goes to this viewcontroller and this code
#import "StreamPhotoScreen.h"
#import "API.h"
@implementation StreamPhotoScreen
@synthesize IdPhoto;
-(void)viewDidLoad {
API* api = [API sharedInstance];
//load the caption of the selected photo
[api commandWithParams:[NSMutableDictionary dictionaryWithObjectsAndKeys:@"stream", @"command", IdPhoto,@"IdPhoto", nil] onCompletion:^(NSDictionary *json) {
//show the text in the label
NSArray* list = [json objectForKey:@"result"];
NSDictionary* photo = [list objectAtIndex:0];
lblTitle.text = [photo objectForKey:@"title"];
}];
//load the big size photo
NSURL* imageURL = [api urlForImageWithId:IdPhoto isThumb:NO];
[photoView setImageWithURL: imageURL];
}
-(BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
// Return YES for supported orientations
return (interfaceOrientation == UIInterfaceOrientationPortrait);
}
-(void)viewWillAppear:(BOOL)animated {
[super viewWillAppear:animated];
}
@end
Sidenote: I changed the UIImagePicker instance in the native app to a more customizable AVCam instance.
Question: how can we use the below avcam method to tap into the UIDevice currentDevice]
so that when a user taps a native IdPhoto jpegrepresentation on the stream screen, The Iduser of who's photo was clicked, camera hardware triggers via an extension of the below avcam method and shows it to the clicker in the viewcontroller in the place of the segue above.
- (void)snapStillImage //this is being called on did load
{
dispatch_async([self sessionQueue], ^{
// Update the orientation on the still image output video connection before capturing.
[[[self stillImageOutput] connectionWithMediaType:AVMediaTypeVideo] setVideoOrientation:[[(AVCaptureVideoPreviewLayer *)[[self previewView] layer] connection] videoOrientation]];
// Flash set to Auto for Still Capture
[ViewController5 setFlashMode:AVCaptureFlashModeAuto forDevice:[[self videoDeviceInput] device]];
// Capture a still image.
[[self stillImageOutput] captureStillImageAsynchronouslyFromConnection:[[self stillImageOutput] connectionWithMediaType:AVMediaTypeVideo] completionHandler:^(CMSampleBufferRef imageDataSampleBuffer, NSError *error) {
if (imageDataSampleBuffer)
{
NSData *imageData = [AVCaptureStillImageOutput jpegStillImageNSDataRepresentation:imageDataSampleBuffer];
photo.image = [[UIImage alloc] initWithData:imageData];
[[[ALAssetsLibrary alloc] init] writeImageToSavedPhotosAlbum:[photo.image CGImage] orientation:(ALAssetOrientation)[photo.image imageOrientation] completionBlock:nil];
[self uploadPhoto];
}
}];
});
}
I want to achieve the above using any methodology available if anyone has any references or code I can work with.
I am creating a random number game that has 9 different numbers and i want to randomise the numbers so they are randomised with non duplicates (e.g., 1,4,2,3,6,5,9,7,8) but at the moment i am just getting 9random numbers between 1 and 9 with multiple duplicates. Can anyone suggest anything without changing the existing code too much.
Thank you.
-(IBAction)Randomise
{
int rNumber1 = arc4random_uniform(9);
Text1.text = [NSString stringWithFormat: @"%d",rNumber1 + 1];
if ([Text1.text isEqualToString: @"1"])
{
[AnimatedPicture setImage:[UIImage imageNamed:@"1.png"]];
}
else if ([Text1.text isEqualToString: @"2"])
{
[AnimatedPicture setImage:[UIImage imageNamed:@"2.png"]];
}
else if ([Text1.text isEqualToString: @"3"])
{
[AnimatedPicture setImage:[UIImage imageNamed:@"3.png"]];
}
else if ([Text1.text isEqualToString: @"4"])
{
[AnimatedPicture setImage:[UIImage imageNamed:@"4.png"]];
}
else if ([Text1.text isEqualToString: @"5"])
{
[AnimatedPicture setImage:[UIImage imageNamed:@"5.png"]];
}
else if ([Text1.text isEqualToString: @"6"])
{
[AnimatedPicture setImage:[UIImage imageNamed:@"6.png"]];
}
else if ([Text1.text isEqualToString: @"7"])
{
[AnimatedPicture setImage:[UIImage imageNamed:@"7.png"]];
}
else if ([Text1.text isEqualToString: @"8"])
{
[AnimatedPicture setImage:[UIImage imageNamed:@"8.png"]];
}
else if ([Text1.text isEqualToString: @"9"])
{
[AnimatedPicture setImage:[UIImage imageNamed:@"9.png"]];
}
int rNumber2 = arc4random_uniform(9);
Text2.text = [NSString stringWithFormat: @"%d",rNumber2+1];
if ([Text2.text isEqualToString: @"1"])
{
[AnimatedPicture1 setImage:[UIImage imageNamed:@"1.png"]];
}
else if ([Text2.text isEqualToString: @"2"])
{
[AnimatedPicture1 setImage:[UIImage imageNamed:@"2.png"]];
}
else if ([Text2.text isEqualToString: @"3"])
{
[AnimatedPicture1 setImage:[UIImage imageNamed:@"3.png"]];
}
else if ([Text2.text isEqualToString: @"4"])
{
[AnimatedPicture1 setImage:[UIImage imageNamed:@"4.png"]];
}
else if ([Text2.text isEqualToString: @"5"])
{
[AnimatedPicture1 setImage:[UIImage imageNamed:@"5.png"]];
}
else if ([Text2.text isEqualToString: @"6"])
{
[AnimatedPicture1 setImage:[UIImage imageNamed:@"6.png"]];
}
else if ([Text1.text isEqualToString: @"7"])
{
[AnimatedPicture setImage:[UIImage imageNamed:@"7.png"]];
}
else if ([Text1.text isEqualToString: @"8"])
{
[AnimatedPicture setImage:[UIImage imageNamed:@"8.png"]];
}
else if ([Text1.text isEqualToString: @"9"])
{
[AnimatedPicture setImage:[UIImage imageNamed:@"9.png"]];
}
int rNumber3 = arc4random_uniform(9);
Text3.text = [NSString stringWithFormat: @"%d",rNumber3+1];
if ([Text3.text isEqualToString: @"1"])
{
[AnimatedPicture2 setImage:[UIImage imageNamed:@"1.png"]];
}
else if ([Text3.text isEqualToString: @"2"])
{
[AnimatedPicture2 setImage:[UIImage imageNamed:@"2.png"]];
}
else if ([Text3.text isEqualToString: @"3"])
{
[AnimatedPicture2 setImage:[UIImage imageNamed:@"3.png"]];
}
else if ([Text3.text isEqualToString: @"4"])
{
[AnimatedPicture2 setImage:[UIImage imageNamed:@"4.png"]];
}
else if ([Text3.text isEqualToString: @"5"])
{
[AnimatedPicture2 setImage:[UIImage imageNamed:@"5.png"]];
}
else if ([Text3.text isEqualToString: @"6"])
{
[AnimatedPicture2 setImage:[UIImage imageNamed:@"6.png"]];
}
else if ([Text3.text isEqualToString: @"7"])
{
[AnimatedPicture2 setImage:[UIImage imageNamed:@"7.png"]];
}
else if ([Text3.text isEqualToString: @"8"])
{
[AnimatedPicture2 setImage:[UIImage imageNamed:@"8.png"]];
}
else if ([Text3.text isEqualToString: @"9"])
{
[AnimatedPicture2 setImage:[UIImage imageNamed:@"9.png"]];
}
int rNumber4 = arc4random_uniform(9);
Text4.text = [NSString stringWithFormat: @"%d",rNumber4+1];
if ([Text4.text isEqualToString: @"1"])
{
[AnimatedPicture3 setImage:[UIImage imageNamed:@"1.png"]];
}
else if ([Text4.text isEqualToString: @"2"])
{
[AnimatedPicture3 setImage:[UIImage imageNamed:@"2.png"]];
}
else if ([Text4.text isEqualToString: @"3"])
{
[AnimatedPicture3 setImage:[UIImage imageNamed:@"3.png"]];
}
else if ([Text4.text isEqualToString: @"4"])
{
[AnimatedPicture3 setImage:[UIImage imageNamed:@"4.png"]];
}
else if ([Text4.text isEqualToString: @"5"])
{
[AnimatedPicture3 setImage:[UIImage imageNamed:@"5.png"]];
}
else if ([Text4.text isEqualToString: @"6"])
{
[AnimatedPicture3 setImage:[UIImage imageNamed:@"6.png"]];
}
else if ([Text4.text isEqualToString: @"7"])
{
[AnimatedPicture3 setImage:[UIImage imageNamed:@"7.png"]];
}
else if ([Text4.text isEqualToString: @"8"])
{
[AnimatedPicture3 setImage:[UIImage imageNamed:@"8.png"]];
}
else if ([Text4.text isEqualToString: @"9"])
{
[AnimatedPicture3 setImage:[UIImage imageNamed:@"9.png"]];
}
int rNumber5 = arc4random_uniform(9);
Text5.text = [NSString stringWithFormat: @"%d",rNumber5+1];
if ([Text5.text isEqualToString: @"1"])
{
[AnimatedPicture4 setImage:[UIImage imageNamed:@"1.png"]];
}
else if ([Text5.text isEqualToString: @"2"])
{
[AnimatedPicture4 setImage:[UIImage imageNamed:@"2.png"]];
}
else if ([Text5.text isEqualToString: @"3"])
{
[AnimatedPicture4 setImage:[UIImage imageNamed:@"3.png"]];
}
else if ([Text5.text isEqualToString: @"4"])
{
[AnimatedPicture4 setImage:[UIImage imageNamed:@"4.png"]];
}
else if ([Text5.text isEqualToString: @"5"])
{
[AnimatedPicture4 setImage:[UIImage imageNamed:@"5.png"]];
}
else if ([Text5.text isEqualToString: @"6"])
{
[AnimatedPicture4 setImage:[UIImage imageNamed:@"6.png"]];
}
else if ([Text5.text isEqualToString: @"7"])
{
[AnimatedPicture4 setImage:[UIImage imageNamed:@"7.png"]];
}
else if ([Text5.text isEqualToString: @"8"])
{
[AnimatedPicture4 setImage:[UIImage imageNamed:@"8.png"]];
}
else if ([Text5.text isEqualToString: @"9"])
{
[AnimatedPicture4 setImage:[UIImage imageNamed:@"9.png"]];
}
int rNumber6 = arc4random_uniform(9);
Text6.text = [NSString stringWithFormat: @"%d",rNumber6+1];
if ([Text6.text isEqualToString: @"1"])
{
[AnimatedPicture5 setImage:[UIImage imageNamed:@"1.png"]];
}
else if ([Text6.text isEqualToString: @"2"])
{
[AnimatedPicture5 setImage:[UIImage imageNamed:@"2.png"]];
}
else if ([Text6.text isEqualToString: @"3"])
{
[AnimatedPicture5 setImage:[UIImage imageNamed:@"3.png"]];
}
else if ([Text6.text isEqualToString: @"4"])
{
[AnimatedPicture5 setImage:[UIImage imageNamed:@"4.png"]];
}
else if ([Text6.text isEqualToString: @"5"])
{
[AnimatedPicture5 setImage:[UIImage imageNamed:@"5.png"]];
}
else if ([Text6.text isEqualToString: @"6"])
{
[AnimatedPicture5 setImage:[UIImage imageNamed:@"6.png"]];
}
else if ([Text6.text isEqualToString: @"7"])
{
[AnimatedPicture5 setImage:[UIImage imageNamed:@"7.png"]];
}
else if ([Text6.text isEqualToString: @"8"])
{
[AnimatedPicture5 setImage:[UIImage imageNamed:@"8.png"]];
}
else if ([Text6.text isEqualToString: @"9"])
{
[AnimatedPicture5 setImage:[UIImage imageNamed:@"9.png"]];
}
int rNumber7 = arc4random_uniform(9);
Text7.text = [NSString stringWithFormat: @"%d",rNumber7+1];
if ([Text7.text isEqualToString: @"1"])
{
[AnimatedPicture6 setImage:[UIImage imageNamed:@"1.png"]];
}
else if ([Text7.text isEqualToString: @"2"])
{
[AnimatedPicture6 setImage:[UIImage imageNamed:@"2.png"]];
}
else if ([Text7.text isEqualToString: @"3"])
{
[AnimatedPicture6 setImage:[UIImage imageNamed:@"3.png"]];
}
else if ([Text7.text isEqualToString: @"4"])
{
[AnimatedPicture6 setImage:[UIImage imageNamed:@"4.png"]];
}
else if ([Text7.text isEqualToString: @"5"])
{
[AnimatedPicture6 setImage:[UIImage imageNamed:@"5.png"]];
}
else if ([Text7.text isEqualToString: @"6"])
{
[AnimatedPicture6 setImage:[UIImage imageNamed:@"6.png"]];
}
else if ([Text7.text isEqualToString: @"7"])
{
[AnimatedPicture6 setImage:[UIImage imageNamed:@"7.png"]];
}
else if ([Text7.text isEqualToString: @"8"])
{
[AnimatedPicture6 setImage:[UIImage imageNamed:@"8.png"]];
}
else if ([Text7.text isEqualToString: @"9"])
{
[AnimatedPicture6 setImage:[UIImage imageNamed:@"9.png"]];
}
int rNumber8 = arc4random_uniform(9);
Text8.text = [NSString stringWithFormat: @"%d",rNumber8+1];
if ([Text8.text isEqualToString: @"1"])
{
[AnimatedPicture7 setImage:[UIImage imageNamed:@"1.png"]];
}
else if ([Text8.text isEqualToString: @"2"])
{
[AnimatedPicture7 setImage:[UIImage imageNamed:@"2.png"]];
}
else if ([Text8.text isEqualToString: @"3"])
{
[AnimatedPicture7 setImage:[UIImage imageNamed:@"3.png"]];
}
else if ([Text8.text isEqualToString: @"4"])
{
[AnimatedPicture7 setImage:[UIImage imageNamed:@"4.png"]];
}
else if ([Text8.text isEqualToString: @"5"])
{
[AnimatedPicture7 setImage:[UIImage imageNamed:@"5.png"]];
}
else if ([Text8.text isEqualToString: @"6"])
{
[AnimatedPicture7 setImage:[UIImage imageNamed:@"6.png"]];
}
else if ([Text8.text isEqualToString: @"7"])
{
[AnimatedPicture7 setImage:[UIImage imageNamed:@"7.png"]];
}
else if ([Text8.text isEqualToString: @"8"])
{
[AnimatedPicture7 setImage:[UIImage imageNamed:@"8.png"]];
}
else if ([Text8.text isEqualToString: @"9"])
{
[AnimatedPicture7 setImage:[UIImage imageNamed:@"9.png"]];
}
int rNumber9 = arc4random_uniform(9);
Text9.text = [NSString stringWithFormat: @"%d",rNumber9+1];
if ([Text9.text isEqualToString: @"1"])
{
[AnimatedPicture8 setImage:[UIImage imageNamed:@"1.png"]];
}
else if ([Text9.text isEqualToString: @"2"])
{
[AnimatedPicture8 setImage:[UIImage imageNamed:@"2.png"]];
}
else if ([Text9.text isEqualToString: @"3"])
{
[AnimatedPicture8 setImage:[UIImage imageNamed:@"3.png"]];
}
else if ([Text9.text isEqualToString: @"4"])
{
[AnimatedPicture8 setImage:[UIImage imageNamed:@"4.png"]];
}
else if ([Text9.text isEqualToString: @"5"])
{
[AnimatedPicture8 setImage:[UIImage imageNamed:@"5.png"]];
}
else if ([Text9.text isEqualToString: @"6"])
{
[AnimatedPicture8 setImage:[UIImage imageNamed:@"6.png"]];
}
else if ([Text9.text isEqualToString: @"7"])
{
[AnimatedPicture8 setImage:[UIImage imageNamed:@"7.png"]];
}
else if ([Text9.text isEqualToString: @"8"])
{
[AnimatedPicture8 setImage:[UIImage imageNamed:@"8.png"]];
}
else if ([Text9.text isEqualToString: @"9"])
{
[AnimatedPicture8 setImage:[UIImage imageNamed:@"9.png"]];
}
AnimatedPicture.animationImages = [NSArray arrayWithObjects:
[UIImage imageNamed:@"1.png"],
[UIImage imageNamed:@"2.png"],
[UIImage imageNamed:@"3.png"],
[UIImage imageNamed:@"4.png"],
[UIImage imageNamed:@"5.png"],
[UIImage imageNamed:@"6.png"],
[UIImage imageNamed:@"7.png"],
[UIImage imageNamed:@"8.png"],
[UIImage imageNamed:@"9.png"], nil];
AnimatedPicture1.animationImages = [NSArray arrayWithObjects:
[UIImage imageNamed:@"1.png"],
[UIImage imageNamed:@"2.png"],
[UIImage imageNamed:@"3.png"],
[UIImage imageNamed:@"4.png"],
[UIImage imageNamed:@"5.png"],
[UIImage imageNamed:@"6.png"],
[UIImage imageNamed:@"7.png"],
[UIImage imageNamed:@"8.png"],
[UIImage imageNamed:@"9.png"], nil];
AnimatedPicture2.animationImages = [NSArray arrayWithObjects:
[UIImage imageNamed:@"1.png"],
[UIImage imageNamed:@"2.png"],
[UIImage imageNamed:@"3.png"],
[UIImage imageNamed:@"4.png"],
[UIImage imageNamed:@"5.png"],
[UIImage imageNamed:@"6.png"],
[UIImage imageNamed:@"7.png"],
[UIImage imageNamed:@"8.png"],
[UIImage imageNamed:@"9.png"], nil];
AnimatedPicture3.animationImages = [NSArray arrayWithObjects:
[UIImage imageNamed:@"1.png"],
[UIImage imageNamed:@"2.png"],
[UIImage imageNamed:@"3.png"],
[UIImage imageNamed:@"4.png"],
[UIImage imageNamed:@"5.png"],
[UIImage imageNamed:@"6.png"],
[UIImage imageNamed:@"7.png"],
[UIImage imageNamed:@"8.png"],
[UIImage imageNamed:@"9.png"], nil];
AnimatedPicture4.animationImages = [NSArray arrayWithObjects:
[UIImage imageNamed:@"1.png"],
[UIImage imageNamed:@"2.png"],
[UIImage imageNamed:@"3.png"],
[UIImage imageNamed:@"4.png"],
[UIImage imageNamed:@"5.png"],
[UIImage imageNamed:@"6.png"],
[UIImage imageNamed:@"7.png"],
[UIImage imageNamed:@"8.png"],
[UIImage imageNamed:@"9.png"], nil];
AnimatedPicture5.animationImages = [NSArray arrayWithObjects:
[UIImage imageNamed:@"1.png"],
[UIImage imageNamed:@"2.png"],
[UIImage imageNamed:@"3.png"],
[UIImage imageNamed:@"4.png"],
[UIImage imageNamed:@"5.png"],
[UIImage imageNamed:@"6.png"],
[UIImage imageNamed:@"7.png"],
[UIImage imageNamed:@"8.png"],
[UIImage imageNamed:@"9.png"], nil];
AnimatedPicture6.animationImages = [NSArray arrayWithObjects:
[UIImage imageNamed:@"1.png"],
[UIImage imageNamed:@"2.png"],
[UIImage imageNamed:@"3.png"],
[UIImage imageNamed:@"4.png"],
[UIImage imageNamed:@"5.png"],
[UIImage imageNamed:@"6.png"],
[UIImage imageNamed:@"7.png"],
[UIImage imageNamed:@"8.png"],
[UIImage imageNamed:@"9.png"], nil];
AnimatedPicture7.animationImages = [NSArray arrayWithObjects:
[UIImage imageNamed:@"1.png"],
[UIImage imageNamed:@"2.png"],
[UIImage imageNamed:@"3.png"],
[UIImage imageNamed:@"4.png"],
[UIImage imageNamed:@"5.png"],
[UIImage imageNamed:@"6.png"],
[UIImage imageNamed:@"7.png"],
[UIImage imageNamed:@"8.png"],
[UIImage imageNamed:@"9.png"], nil];
AnimatedPicture8.animationImages = [NSArray arrayWithObjects:
[UIImage imageNamed:@"1.png"],
[UIImage imageNamed:@"2.png"],
[UIImage imageNamed:@"3.png"],
[UIImage imageNamed:@"4.png"],
[UIImage imageNamed:@"5.png"],
[UIImage imageNamed:@"6.png"],
[UIImage imageNamed:@"7.png"],
[UIImage imageNamed:@"8.png"],
[UIImage imageNamed:@"9.png"], nil];
[AnimatedPicture setAnimationRepeatCount:3];
AnimatedPicture.animationDuration = 1.0;
[AnimatedPicture startAnimating];
[AnimatedPicture1 setAnimationRepeatCount:3];
AnimatedPicture1.animationDuration = 1.0;
[AnimatedPicture1 startAnimating];
[AnimatedPicture2 setAnimationRepeatCount:3];
AnimatedPicture2.animationDuration = 1.0;
[AnimatedPicture2 startAnimating];
[AnimatedPicture3 setAnimationRepeatCount:3];
AnimatedPicture3.animationDuration = 1.0;
[AnimatedPicture3 startAnimating];
[AnimatedPicture4 setAnimationRepeatCount:3];
AnimatedPicture4.animationDuration = 1.0;
[AnimatedPicture4 startAnimating];
[AnimatedPicture5 setAnimationRepeatCount:3];
AnimatedPicture5.animationDuration = 1.0;
[AnimatedPicture5 startAnimating];
[AnimatedPicture6 setAnimationRepeatCount:3];
AnimatedPicture6.animationDuration = 1.0;
[AnimatedPicture6 startAnimating];
[AnimatedPicture7 setAnimationRepeatCount:3];
AnimatedPicture7.animationDuration = 1.0;
[AnimatedPicture7 startAnimating];
[AnimatedPicture8 setAnimationRepeatCount:3];
AnimatedPicture8.animationDuration = 1.0;
[AnimatedPicture8 startAnimating];
}
I am developing a uiCollection view, In which i have 4 cells, on 4th cell i have uiview which hold button and ui textview. once i tap button the textview should reveal and close.
I don't know how to handle this, how to increase particular cell size on inaction in cell object
UICollectionview.M
#pragma mark - UICollectionView DataSource & Delegate methods
- (NSInteger)numberOfSectionsInCollectionView:(UICollectionView *)collectionView{
return 4;
}
- (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section
{
return 1;
}
- (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath
{
if (indexPath.section==2) {
UICollectionViewCell * cell =[collectionView dequeueReusableCellWithReuseIdentifier:cellIdentifier2 forIndexPath:indexPath];
return cell;
}
else if(indexPath.section==1){
UICollectionViewCell * cell =[collectionView dequeueReusableCellWithReuseIdentifier:cellIdentifier1 forIndexPath:indexPath];
return cell;
}
else if(indexPath.section==0){
UICollectionViewCell * cell =[collectionView dequeueReusableCellWithReuseIdentifier:cellIdentifier forIndexPath:indexPath];
return cell;
}
else{
infoCell * cell =[collectionView dequeueReusableCellWithReuseIdentifier:cellIdentifier3 forIndexPath:indexPath];
return cell;
}
}
- (CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout sizeForItemAtIndexPath:(NSIndexPath *)indexPath{
if (indexPath.section == 3) {
return CGSizeMake(self.width, self.height);
}
else{
return CGSizeMake(309, 300);
}
}
@end
cell object
cellobject.h
@interface InfoCell : UICollectionViewCell
{
BOOL toggleIsOn;
}
@property (weak, nonatomic) IBOutlet UIView *infoView;
@property (weak, nonatomic) IBOutlet UIButton *dropDownButton;
@property (weak, nonatomic) IBOutlet UITextView *infoDescrip;
@end
cell object.m
-(IBAction)revealDescription:(id)sender{
if (toggleIsOn)
{
self.infoDescrip.hidden= YES;
self.infoView.frame=CGRectMake(0, 0, 309,44);
}
else
{
self.infoDescrip.hidden= NO;
NSDictionary *attributes = @{NSFontAttributeName: [UIFont fontWithName:@"HelveticaNeue" size:14]};
CGRect rect = [self.infoDescrip.text boundingRectWithSize:CGSizeMake(300, CGFLOAT_MAX) options:NSStringDrawingUsesLineFragmentOrigin
attributes:attributes context:nil];
self.infoDescrip.frame= CGRectMake(0, 46, 300, rect.size.height);
self.infoView.frame=CGRectMake(0, 0, 309, rect.size.height+50);
}
toggleIsOn = !toggleIsOn;
[self.dropDownButton setImage:[UIImage imageNamed:toggleIsOn ? @"arrow_down_blue" :@"arrow_right_blue"] forState:UIControlStateNormal];
}
I am struggling to get out of this any help?
I am working with auto layout . Facing on interesting issue . Fortunately overcame from it for the time but need to know the best way to solve it .
Problem : As showing in the above figure I have couple of buttons . Both needed to place at equidistance width from the centre of the UIView (bold vertical line is centre of the view). Also I have to apply to constraint in such a way that distance between the button will be automatically adjusted. for e.g. the distance should be 25% of the device width. If my device width is 320 the distance between the button is 80 pixels and so on.
Solution(I have tried) : For above problem I tried on solution . As shown in the figure I have added on dummy view in the UIView the width of the dummy view is equal to spacing between two buttons. And then I have applied the constraints to the dummy view. such as : 1. Horizontal centre of the UIView 2.Width equals to the UIView width with 0.25 as a multiplier
Question: above solution is working perfectly for me . But if in future if my view will have too many complex elements then adding dummy view might not be the good idea . So, Is there any other clean way to do this ?
I've been trying to implement the fetch completion block with no luck. Whenever I send an APN, xcode still complains that it's not implemented. Here's my code
func application(application: UIApplication, didReceiveRemoteNotification userInfo: [NSObject : AnyObject], fetchCompletionHandler completionHandler: (UIBackgroundFetchResult) -> Void) {
println("2. User Data", userInfo)
completionHandler(UIBackgroundFetchResult.NewData)
}
and the warning I am getting in the xcode console is this
Warning: Application delegate received call to -application:didReceiveRemoteNotification:fetchCompletionHandler: but the completion handler was never called.
Not sure if I am implementing the right syntax here
I'm basically trying to pass data from a UITableView's cell, from one viewcontroller to my second viewcontroller when deleting a cell from the first viewcontroller.
Here's the code for my first viewcontroller class trying to pass the tableview data to an Array in my other viewcontroller class:
var deletedProperty: [String] = []
var storedDeletion: [String] = []
func tableView(tableView: UITableView, commitEditingStyle editingStyle: UITableViewCellEditingStyle, forRowAtIndexPath indexPath: NSIndexPath) {
if(editingStyle == UITableViewCellEditingStyle.Delete){
storedDeletion.append(deletedProperty[indexPath.row])
taskMgr.tasks.removeAtIndex(indexPath.row)
tblTasks.reloadData();
}
}
override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) {
if segue.identifier == "YourIdentifier" {
let destination = segue.destinationViewController as ThirdViewController; destination.secondTaskMgr = storedDeletion
}
}
Here's the code for my other viewcontroller class containing the Array:
var secondTaskMgr: SecondTaskManager = SecondTaskManager()
struct secondTask {
var passedName = ""
}
class SecondTaskManager: NSObject {
var secondTasks = [secondTask]()
func secondAddTask(name: String){
secondTasks.append(secondTask(passedName: name))
}
}
In the first viewcontroller class I get the error "'NSArray' is not a subtype of 'ThirdViewController.SecondTaskManager'" at
let destination = segue.destinationViewController as ThirdViewController; destination.secondTaskMgr = storedDeletion
What's the issue here and how do I fix it? And is there any better way to do this?
Bootstrap modal fade is working perfectly on chrome/internet explorer, but It doesn't work on iPhone/Safari. Does someone a solution for this issue?
Here's the website: http://ift.tt/1MZmlpO. It is a WordPress site.
Everything seems to work fine, accept the logo at the top of the website disappears, and never comes back. I have no idea why.
And randomly, the phone number disappears from the contact page.
Love some help figuring this out. If there is any code you'd like to see, let me know and I'll get it. Thanks!
I'm having problem to set the audio volume when mixing a recorded video and an audio from resource.
Here is my code:
AVMutableComposition *composition = [[AVMutableComposition alloc] init];
NSString *resourcePath = [[NSBundle mainBundle] pathForResource:@"give-it-away" ofType:@"mp3"];
AVURLAsset *audioAsset = [[AVURLAsset alloc] initWithURL:[NSURL fileURLWithPath:resourcePath] options:[NSDictionary dictionaryWithObjectsAndKeys:[NSNumber numberWithBool:YES],AVURLAssetPreferPreciseDurationAndTimingKey, nil]];
AVMutableCompositionTrack *videoTrack = [composition addMutableTrackWithMediaType:AVMediaTypeVideo preferredTrackID:kCMPersistentTrackID_Invalid];
AVMutableCompositionTrack *audioTrack = [composition addMutableTrackWithMediaType:AVMediaTypeAudio preferredTrackID:kCMPersistentTrackID_Invalid];
[videoTrack insertTimeRange:CMTimeRangeMake(kCMTimeZero, videoAsset.duration) ofTrack:[videoAsset.tracks objectAtIndex:0] atTime:kCMTimeZero error:nil];
[audioTrack insertTimeRange:CMTimeRangeMake(kCMTimeZero, audioTime) ofTrack:[audioAsset.tracks objectAtIndex:0] atTime:kCMTimeZero error:&videoError];
AVMutableAudioMixInputParameters *audioInputParams = [AVMutableAudioMixInputParameters audioMixInputParametersWithTrack:audioTrack] ;
[audioInputParams setVolume:0.3 atTime:kCMTimeZero];
[audioInputParams setTrackID:audioTrack.trackID];
AVMutableAudioMix *audioMix = [AVMutableAudioMix audioMix];
audioMix.inputParameters = [NSArray arrayWithObject:audioInputParams];
AVAssetExportSession *exportSession = [[AVAssetExportSession alloc] initWithAsset:composition presetName:AVAssetExportPresetPassthrough];
exportSession.outputURL = [NSURL fileURLWithPath:finalVideoWithAudioPath];
exportSession.outputFileType = AVFileTypeQuickTimeMovie;
exportSession.audioMix = audioMix;
[exportSession exportAsynchronouslyWithCompletionHandler:^{
switch (exportSession.status)
{
case AVAssetExportSessionStatusFailed:
{
[self performSelectorOnMainThread:@selector(doPostExportFailed) withObject:nil waitUntilDone:NO];
break;
}
case AVAssetExportSessionStatusCompleted:
{
[self performSelectorOnMainThread:@selector(doPostExportSuccess) withObject:nil waitUntilDone:YES];
break;
}
};
}];
The export completes successfully, but the audio volume does not change. What am I doing wrong?
Thanks
I have an iphone app in App Store, its installed on my device for demonstrations. I'm also developing the next version and need to see how it runs on my device, not just in simulator, but when connecting the device for debug with xcode, the store version get's overwritten. This behavior results in multiply uninstall & install of the application from the store which is bad for app rating (apple algorithm takes uninstall into account).
Is there a way to have both version running on the same device?
I have searched for API in Google but i didn't get any thing. Is there any API available for apple Watch watch kit such as accelerometer, heart rate monitor, Tap tic engine sensor. How can i use that.
is there any code to say something like: the banner has been touched /pressed?
banner.touched doesn't exist, but it is just an example of what could be.
I am using an online based inventory tracking system called Tracmor. I'm wondering if there's an app for Iphone or some feature that allows you to scan barcodes from your iphone keyboard. The way I am able to input data inventory data into tracmor is by selecting the field in the Tracmor online portal, which pulls up the iphone keyboard. Ideally, I would like to scan the bar code from this point for the field. I know this is possible for android, but I have not found the solution for iphone. I am currently using an Iphone6.
Thank you, Maya
Do you think the changing of the drinking limit to 0.05% does it do much difference to anything. I am doing my senior project and I thing changing it from 0.08% doesn't make much difference.
I have a UITableView, and it displays data received from a WiFi-connected device.
I want to do the fairly bog-standard gesture response of dragging a table down, then releasing it, to trigger an update.
I guess I could attach a swipe gesture recognizer to the table's substrate view, but I'm wondering if there is a way to intercept this gesture directly from the table itself.
META:
I've been looking through the various docs and whatnot. I haven't had to do this before, so I never gave it any thought. Now I see that I probably should have thought about it.
If this is an obvious solution, I don't mind being told so, as long as you help me to find the "obvious" remedy. I'll delete this question if it's a bad one.
However, I haven't found a solution, and I'm usually fairly good at that kind of thing.
I would like use camera in my iPhone inside of View. I don't want use typical full screen camera view, but my own.
For example I would like have a square 200x200 at the middle of the screen and there have a camera preview. Below this square I would like have a button to take a picture. How to do it? I'm swift beginer.
I'm very new to swift. I added disclosure indicators to my TableView. I want to make the different disclosure indicators lead to different view controllers. Can anyone help me with this?
how can i encrypt my shell script with out password and SHC because if i encrypted with SHC it will get Error on IOS Terminal so iwant something that encrypt my shell script and work on IOS .
I wrote a simple script which should close popup window opened by user click (onclick
). However, it does not work in Apple iPhone device which I use to test (iOs 8.1), but seems to work everywhere else.
I found an information about bug in safari HERE
but I wonder is there any workaround which can help make it work for people who using version 8.1?
function popitup(url, windowName) {
var newwindow = window.open(url, windowName, 'height=10px,width=10px,top=5000,left=5000,location=0,menubar=0,resizable=0,scrollbars=0,status=0,titlebar=0,toolbar=0,channelmode=0,directories=0,fullscreen=0');
newwindow.addEventListener('load', function() {
//close popup
newwindow.close();
window.focus();
//redirecting main window
window.location.href = "<?php echo $site_url; ?>/gt/ts";
});
return false;
}
Thanks!
Is there any way to change position of UIRefreshControl activity indicator? Spinner shouldn't be able to move with UITableView which I want to refresh, but should be always at a certain distance from the top of the screen when refreshing starts. It would be helpful even if I can disable default activity indicator, and add a custom, but don't know how to do that, too...
I use this code to make reuse view in UIScrollView
, and it works well. Any idea how to make this code to infinite scrolling with reuse subview in UIScrollView
?
Code
#pragma mark
#pragma mark - SCROLL VIEW DELEGATE METHOD
- (void)scrollViewDidScroll:(UIScrollView *)scrollView {
[self setNeedsLayout];
int currentPosition = floor(scrollView.contentOffset.x);
currentPage = MAX(0,floor(currentPosition / scrollView.frame.size.width));
if(currentPage != refPage)
{
refPage = currentPage;
if ([arrQLst count] > 0)
{
[self replaceHiddenView];
}
}
}
- (void)scrollViewDidEndScrollingAnimation:(UIScrollView *)scrollView
{
if ([arrQLst count] > 0)
{
[self replaceHiddenView];
}
}
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
-(void)replaceHiddenView
{
const double pageWidth =self.frame.size.width;
NSInteger currentIndex;
currentIndex = (([self getScrollView].contentOffset.x - pageWidth) / pageWidth) + 1;
RandomView *currentView = nil;
RandomView *previousView = nil;
RandomView *nextView = nil;
if (CGRectContainsPoint(objRandom1.frame, [self getScrollView].contentOffset))
{
currentView = objRandom1;
previousView = objRandom2;
nextView = objRandom3;
}
else if (CGRectContainsPoint(objRandom2.frame, [self getScrollView].contentOffset))
{
currentView = objRandom2;
previousView = objRandom1;
nextView = objRandom3;
}
else
{
currentView = objRandom3;
previousView = objRandom1;
nextView = objRandom2;
}
currentView.frame = CGRectMake(self.frame.size.width * currentIndex, 0.0, self.frame.size.width, self.frame.size.height);
[currentView setQuestionData:[arrQLst objectAtIndex:currentIndex]];
// Now move the other ones around
// and set them ready for the next scroll
if (currentIndex < [arrQLst count] - 1)
{
nextView.frame = CGRectMake(self.frame.size.width * (currentIndex + 1), 0.0, self.frame.size.width, self.frame.size.height);
[nextView setQuestionData:[arrQLst objectAtIndex:(currentIndex + 1)]];
}
if (currentIndex >= 1)
{
previousView.frame = CGRectMake(self.frame.size.width * (currentIndex - 1), 0.0, self.frame.size.width, self.frame.size.height);
[previousView setQuestionData:[arrQLst objectAtIndex:(currentIndex - 1)]];
}
if([arrQLst count] > 0)
[self checkForRequestForLoadMore:currentIndex];
}
-(void)displayViewAtIndex:(NSInteger)index
{
@try
{
NSInteger count = [arrQLst count];
if (index >= 0 && index < count)
{
Ques *objQ = [arrQLst objectAtIndex:index];
objRandom1.frame = CGRectMake(self.frame.size.width * index, 0.0,self.frame.size.width,self.frame.size.height);
[objRandom1 setQuestionData:objQ];
[[self getScrollView] scrollRectToVisible:CGRectMake(self.frame.size.width * index, 0.0, self.frame.size.width, self.frame.size.height) animated:NO];
if (index < (count - 1))
{
objQ = [arrQLst objectAtIndex:(index + 1)];
objRandom2.frame = CGRectMake(self.frame.size.width * (index + 1), 0.0, self.frame.size.width, self.frame.size.height);
[objRandom2 setQuestionData:objQ];
}
if (index > 0)
{
objQ = [arrQLst objectAtIndex:(index - 1)];
objRandom3.frame = CGRectMake(self.frame.size.width * (index - 1), 0.0, self.frame.size.width, self.frame.size.height);
[objRandom3 setQuestionData:objQ];
}
}
}
@catch (NSException *exception)
{
NSLog(@"displayViewAtIndex Exception %s",__PRETTY_FUNCTION__);
}
}
I use this code to make reuse view in UIScrollView
, and it works well. Any idea how to make this code to infinite scrolling with reuse subview in UIScrollView
?
Code
#pragma mark
#pragma mark - SCROLL VIEW DELEGATE METHOD
- (void)scrollViewDidScroll:(UIScrollView *)scrollView {
[self setNeedsLayout];
int currentPosition = floor(scrollView.contentOffset.x);
currentPage = MAX(0,floor(currentPosition / scrollView.frame.size.width));
if(currentPage != refPage)
{
refPage = currentPage;
if ([arrQLst count] > 0)
{
[self replaceHiddenView];
}
}
}
- (void)scrollViewDidEndScrollingAnimation:(UIScrollView *)scrollView
{
if ([arrQLst count] > 0)
{
[self replaceHiddenView];
}
}
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
-(void)replaceHiddenView
{
const double pageWidth =self.frame.size.width;
NSInteger currentIndex;
currentIndex = (([self getScrollView].contentOffset.x - pageWidth) / pageWidth) + 1;
RandomView *currentView = nil;
RandomView *previousView = nil;
RandomView *nextView = nil;
if (CGRectContainsPoint(objRandom1.frame, [self getScrollView].contentOffset))
{
currentView = objRandom1;
previousView = objRandom2;
nextView = objRandom3;
}
else if (CGRectContainsPoint(objRandom2.frame, [self getScrollView].contentOffset))
{
currentView = objRandom2;
previousView = objRandom1;
nextView = objRandom3;
}
else
{
currentView = objRandom3;
previousView = objRandom1;
nextView = objRandom2;
}
currentView.frame = CGRectMake(self.frame.size.width * currentIndex, 0.0, self.frame.size.width, self.frame.size.height);
[currentView setQuestionData:[arrQLst objectAtIndex:currentIndex]];
// Now move the other ones around
// and set them ready for the next scroll
if (currentIndex < [arrQLst count] - 1)
{
nextView.frame = CGRectMake(self.frame.size.width * (currentIndex + 1), 0.0, self.frame.size.width, self.frame.size.height);
[nextView setQuestionData:[arrQLst objectAtIndex:(currentIndex + 1)]];
}
if (currentIndex >= 1)
{
previousView.frame = CGRectMake(self.frame.size.width * (currentIndex - 1), 0.0, self.frame.size.width, self.frame.size.height);
[previousView setQuestionData:[arrQLst objectAtIndex:(currentIndex - 1)]];
}
if([arrQLst count] > 0)
[self checkForRequestForLoadMore:currentIndex];
}
-(void)displayViewAtIndex:(NSInteger)index
{
@try
{
NSInteger count = [arrQLst count];
if (index >= 0 && index < count)
{
Ques *objQ = [arrQLst objectAtIndex:index];
objRandom1.frame = CGRectMake(self.frame.size.width * index, 0.0,self.frame.size.width,self.frame.size.height);
[objRandom1 setQuestionData:objQ];
[[self getScrollView] scrollRectToVisible:CGRectMake(self.frame.size.width * index, 0.0, self.frame.size.width, self.frame.size.height) animated:NO];
if (index < (count - 1))
{
objQ = [arrQLst objectAtIndex:(index + 1)];
objRandom2.frame = CGRectMake(self.frame.size.width * (index + 1), 0.0, self.frame.size.width, self.frame.size.height);
[objRandom2 setQuestionData:objQ];
}
if (index > 0)
{
objQ = [arrQLst objectAtIndex:(index - 1)];
objRandom3.frame = CGRectMake(self.frame.size.width * (index - 1), 0.0, self.frame.size.width, self.frame.size.height);
[objRandom3 setQuestionData:objQ];
}
}
}
@catch (NSException *exception)
{
NSLog(@"displayViewAtIndex Exception %s",__PRETTY_FUNCTION__);
}
}
I have 2 classes, ViewController
class, and Worker
. All the code that I need to run in the background is in the Worker
class.
My ViewController
looks something like this:
- (void)viewDidLoad {
//create an instance of 'Worker'
}
- buttonClick {
//call the 'manager' method in the worker instance that was just created (do this method as a background thread)
}
My Worker
class looks something like this:
- (void)manager {
//call 'repeat' method as a background thread
}
- (void)repeat {
//call 'innerWorker' method as a background thread
}
- (void)innerWorker {
//do work
}
The repeat
method needs to get run every second.
I've tried the 2 following ways to make the repeat
method run every second.
Method 1 :
timerObj = [NSTimer scheduledTimerWithTimeInterval:1.0 target:self selector:@selector(repeatMethod) userInfo:nil repeats:YES];
Method 2: Putting this code at the end of repeat
:
dispatch_queue_t q_background = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_BACKGROUND, 0);
double delayInSeconds = 1.0;
dispatch_time_t popTime = dispatch_time(DISPATCH_TIME_NOW, delayInSeconds * NSEC_PER_SEC);
dispatch_after(popTime, q_background, ^(void){
[self repeatMethod];
});
Both of these 2 methods work fine as long as the app is in the foreground but the moment I press the home button, the repeat
method runs one last time, but does not call the innerWorker
method and then the app is suspended. I know this by using NSLogs all over the place.
I realize Method 2 is a bit of a hack but that's fine as this is an internal app that I wont be publishing.
All the methods are called as background threads using this code: eg:
dispatch_queue_t q_background = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_BACKGROUND, 0);
dispatch_async(q_background, ^{
[self repeatMethod];
});
I'm new to iOS so maybe I'm missing something small here. I just want my app to keep running in the background. Please help me.
When i click a button in one viewcontroller ,i want to go to other tapbarviewcontroller
1.i have a tap-bar view controller name "my view" with navigation controller
error i am getting is:
when i click on the button its navigating to public view controller but the tap-bar is in the same position in "my view"
help me thanks in advance
I recent came to know that you can make your own mobile apps in magento, so i googled the topic and found that magento has it inbuilt since CE1.5, then i have downloaded the latest version of magento and installed it on local server but i am not able see the "mobile" menu admin panel. Then i have posted a question on "magento.stackexchange" but since 3 days nobody replied to the question so i now posting it here again. Please see the link for my question.
I'm creating and update of one of my app, it uses sthttprequest and jsonkit. From this february apple require the supporting for 64 bit architectures, i have already seen this warning in the past months :
iOS app submission : missing 64-bit support
So i have added "Standard architectures" in my build settings to support arm64 and i have setted Build Active Architecture Only to NO. I have made a build with an iphone 6 (with iphone 5 it's all ok) and i have received many error, some of them it's easy to solve, but this error not:
file not found: /Users/*****/Library/Developer/Xcode/DerivedData/*****-brhcaqkzbwghmreypofgoustfozt/Build/Intermediates/****.build/Debug-iphoneos/****.build/Objects-normal/arm64/JSONKit.o clang: error: linker command failed with exit code 1 (use -v to see invocation)
I have cleared my derived data but it seems that there is some problem with jsonkit library, the library that SThttprequest use do decode json. It's like it isn't compatible with arm64 it is possible?? How i can do to solve the problem? Changing sthttprequest class is a very long work for me... And i think that i can't update my app without 64 bit support...
i have followed as per instruction to use MBCalendarKit into my app but it doesn't seem to be working . I am posting my code below in swift .
import UIKit
class ViewController: CKCalendarViewController, CKCalendarViewDelegate , CKCalendarViewDataSource {
var data : NSMutableDictionary
override init() {
self.data = NSMutableDictionary()
super.init()
}
required init(coder aDecoder: NSCoder) {
data = NSMutableDictionary()
super.init(coder: aDecoder)
}
override init(nibName nibNameOrNil: String?, bundle nibBundleOrNil: NSBundle?) {
self.data = NSMutableDictionary()
super.init(nibName: nibNameOrNil, bundle: nibBundleOrNil)
}
override func viewDidLoad() {
super.viewDidLoad()
// Step 0 : Wire up the data source and delegate
self.delegate = self
self.dataSource = self
// Step 1 : Define some events
let title : NSString = NSLocalizedString("Add Swift Demo", comment: "")
let date : NSDate = NSDate(day: 9, month: 1, year: 2015)
let event : CKCalendarEvent = CKCalendarEvent(title: title, andDate: date, andInfo: nil)
// Step 2 : Add the events to the cache array
self.data[date] = [event]
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
}
// MARK: - CKCalendarDataSource
func calendarView(calendarView: CKCalendarView!, eventsForDate date: NSDate!) -> [AnyObject]! {
return self.data.objectForKey(date) as [AnyObject]!
}
override func calendarView() -> CKCalendarView! {
return CKCalendarView()
}
}
" install mbcalendarKit . instruction can be found over here http://ift.tt/1eu8QiT
also i think the problem is with podfile but that doesn't seem to be the issue. thanks in advance.
I try to do as instruction at:
but it looks like useless.
always reports the same error.
your comment welcome
please don't bash me if this is a silly question as I'm in no way a VPN or networks guy.
We'd like to evaluate per-app VPN so that specifc apps and / or specific safari domains may route through VPN while other apps / domains remain outside the corporate network. While I suppose to understand the concept of that bit quite well I'm not so sure about implications of the user switching networks.
Will per-app VPN be aware of say a corporate network where direct access is granted and VPN is not necessary or even not possible? Other way of putting this would be: Will per-app VPN play along with on-demand VPN?
Example:
User John Doe has a corporate iPhone with per-app VPN installed with a policy to route safari traffic to example.com to the VPN if he is not currently in the corporate network of his own "example company" where he obviously doesn't need VPN.
Many thanks and kind regards
Jens
I'm having problem with iOS app (I'm not iOS developer, I'm responsible for API that that app uses) and DELETE requests.
Api is using 204 responses with no content for DELETE requests and that have worked fine for all the client applications so far, without any problems.
The issue is that when using NSUrlConnection all those DELETE requests either are processed for more than 60 seconds or fail because of timeout.
This behaviour is only visible in out iOS implementations, other clients are getting response for exactly same request in less than 100ms.
Is this common behaviour? Do anyone know any fix for that that hopefully doesn't require API rebuild?
Code below was created just to emulate this behaviour and replicate problem on API development team side, but problem is the same (Access token obscured of course, authentication works fine):
//
// ViewController.m
// NoteablesTest
#import "ViewController.h"
@interface ViewController ()
@property (weak, nonatomic) IBOutlet UILabel *loadingLabel;
@end
@implementation ViewController
- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
[_loadingLabel setHidden:true];
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
- (IBAction)didButtonTouched:(id)sender {
NSString *url = @"http://ift.tt/1DOGSJr";
NSMutableURLRequest *request = [[NSMutableURLRequest alloc] initWithURL:[NSURL URLWithString:url]];
[request setHTTPMethod:@"DELETE"];
[request setValue:@"Bearer XXXX" forHTTPHeaderField:@"Authorization"];
[request setValue:@"Noteables/1.0 (iPhone; iOS 8.1.3; Scale/2.00)" forHTTPHeaderField:@"User-Agent"];
[request setValue:@"application/vnd.api.v1+json" forHTTPHeaderField:@"Content-Type"];
[request setValue:@"en;q=1" forHTTPHeaderField:@"Accept-Language"];
NSDate *start = [NSDate date];
[_loadingLabel setHidden:false];
[NSURLConnection sendAsynchronousRequest:request queue:[NSOperationQueue mainQueue] completionHandler:^(NSURLResponse *response, NSData *data, NSError *connectionError) {
double timePassed = [start timeIntervalSinceNow];
NSString *message = [NSString stringWithFormat:@"Elapsed: %f seconds", timePassed];
[_loadingLabel setHidden:true];
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Result!" message: message delegate:self cancelButtonTitle:@"Am I satisfied with this?" otherButtonTitles:nil, nil];
[alert show];
NSLog(@"%@", response);
}];
}
@end
I am trying to parse a JSON response into an NSArray for a specific item (geometry/location/lat). I easily manage to get the name into an array with
for (NSDictionary *object in results)
{
NSString *objectName = object[@"name"];
[MyArray addObject:objectName];
}
but I don't know how to dig down to the "lat" level in order to extract this...
JSON DATA full results: (
{
geometry = {
location = {
lat = “15.122494";
lng = “45.518496";
};
};
icon = "http://ift.tt/1zl6Dev";
id = 1767ee03046d7ac7273be472310cfb6d7b2e6;
name = “Cafe Syracuse”;
photos = (
{
height = 768;
"html_attributions" = (
"From a Google User"
);
"photo_reference" = "CnRoAAAAlVZmfP0Dn3HIwcaEozcjYHqPMC_VlWcvz2sH0yYNjv9DS1GIccAvAp-LNaWxAWKvnEifhPU-1b8ETx7sXtOR7UKSs7tOBpai4FPM1y6M-lcL2qJ4M0dizbHStidxuGCF_QnE548qsE1tP2ZTdhjY_BIQKxSTS_-rPxGlOZmAG7oUUBSiV276H4CemarEXRozEtVr5Vs";
width = 1024;
}
);
"place_id" = ChIJB6K6CExRr8f4AvaA09U;
rating = "4.5";
reference = "CnRjAAAA5Yh4QrEnn7xH2URR7-gwwrhbUz2qmlwbCRW4-JkMfINdldXIYhQR8p2kTdiZiYsdX67nwINp963XIxysFPWOAVZ-okFCu0VH9NL66EWiPSVBFGSgYKXCd7LuhOFMgeU1yLuegyCMQ7RX6mjkhIQiVVok262SeOJGsChxoUXx6DKhp7t_uM51w2y9_bJAlscAA";
scope = GOOGLE;
types = (
cafe,
establishment
);
vicinity = “White glacier";
},
{
geometry = //Other item
Many thanks
I know we can use TAG to identify the elements. But I am creating a dynamic library which gets injected to other app on a jailbroken iPhone and starts scraping data. So using tag is no option for me since I dont have the control.
I see object ID in storyboard is uniques for all elements. but it is not accessible in code and we cant get the element using that.
The problem is when I try to reproduce users recorded action, I dont know which button he clicked (same for all other UIElemetns).
Is there any other way or identifiers for UIElements to access at runtime?
There is an array having same objects in single array , i need to compare these array’s index with another array.. Give me a help. Something like:
NSMutableArray *latArray = [NSMutableArray arrayWithObjects:@“43.20,@“43.23”,@“43.24”,@“43.20”,nil];
NSMutableArray *lngArray = [NSMutableArray arrayWithObjects:@“76.90”,@“76.94”,@“76.92”,@“76.90”,nil];
NSMutableArray *imagesArray = [[NSMutableArray alloc] initWithObjects:@"1.jpg", @"2.jpg”,@“3.jpg”,@“4.jpg”,nil];
resultResult = @"1.jpg", @“5.jpg” // because the index 0 and index 3 same values in both array.
I am working on an app that is mostly used in portrait mode (except for a few views). We are encountering an issue in iOS 8 where the app is able to rotate when an UIViewAlert
is shown, even though the underlaying view controller only supports portrait orientation and its shouldAutorotate
method returns NO. The rotation is not even full as the UIAlertView
rotates to landscape, but the underlying view remains in portrait mode. There is no problem if we run the app in iOS 7.
I know that UIAlertView
has been deprecated in iOS 8 and that we should now use UIAlertController
. However, I would really like to avoid having to replace it as this would mean editing 50+ classes that use UIAlertView
and UIAlertViewDelegate
. Also, we still support iOS 7 so I would have to have both solutions. I would prefer only to have to do this once, when we make the full switch to iOS 8.
I have an app that mostly only uses portrait mode. However, when it presents MFMailComposeViewController
and MFMessageComposeViewController
it is able to rotate to landscape. This has worked fine until iOS 8 where they still rotate, but their bounds seem to follow the wrong orientation.
I have the app in portrait mode and present one of those controllers. When I rotate phone into landscape I get the following result:
MFMailComposeViewController
:
MFMessageComposeViewController
:
I have a small web page, which uses the following code to set a selection by one click:
function select_element()
{
if (window.getSelection && document.createRange) {
sel = window.getSelection();
range = document.createRange();
range.selectNodeContents(this);
sel.removeAllRanges();
sel.addRange(range);
} else
if (document.body.createTextRange) {
range = document.body.createTextRange();
range.moveToElementText(this);
range.select();
}
}
It works in most browsers as you can see here.
But it does not work on an iPhone. The text just flashes and nothing gets selected. How to select text on the iPhone browser with JavaScript?
The aim is to make it easy to copy the text to the clipboard.
My question is how if i want to replace whole line of the tag <h1></h1>
in to a empty string ""
.
var s = "<h1 style=\"font-family: Helvetica\">Hello Pizza</h1><p>Tap the buttons above to see <strong>some cool stuff</strong> with <code>UIWebView</code><p><img src=\"http://ift.tt/1AQlAJw\">"
var search = "<\\/?strong>"
var replaceWith = ""
var replacementLength = count(replaceWith)
var err: NSError? = nil
var expr = NSRegularExpression(pattern: search, options: .CaseInsensitive, error: &err)
if let matches = expr?.matchesInString(s, options: nil, range: NSMakeRange(0, count(s)) ) {
var replacedStringLengthDifference = 0
for match in matches {
var startIndex = advance(s.startIndex, (match.range.location + replacedStringLengthDifference))
var endIndex = advance(s.startIndex, (match.range.length + match.range.location + replacedStringLengthDifference))
replacedStringLengthDifference -= (match.range.length - replacementLength)
s.replaceRange(startIndex..<endIndex, with: replaceWith)
}
}
println(s)
Result:
<h1 style="font-family: Helvetica">Hello Pizza</h1><p>Tap the buttons above to see some cool stuff with <code>UIWebView</code><p><img src="http://ift.tt/1AQlAJw">
Recently I am using twitter official iphone app. I noticed their UITableViewCells have some elements like label, image view and button. But not all of the cells have the same elements, some cells have a someone retweet label, but some cells don't. and some cell have images and some cell don't. So the question how they do it? Are they using multiple dynamic prototype cell?
I'd like to display my website only in landscape mode when viewed from modern smartphones. Is there a way to force the major mobile browsers- Chrome/Firefox/Safari/IE10 to do so? Basically I'd like them to start the browser in landscape mode, irrespective of screen orientation and rotation lock.
Is it too much to ask? I think not because certainly there are games that only play in landscape mode, and the Windows Phone UI home screen uses only portrait mode.
I want to fetch all image names that are in one folder.
What I want to do is, I put all images in a folder named:"Files"
Now is that possible to add all image names to an array, So i dont need to write all images name manually to array or is there any other simple way to do this?