Tag: xcode

Objective-C – Get number of decimals of a double variable

Is there a nice way to get the number of decimals of a double variable in Objective-C? I am struggling for a while to find a way but with no success. For example 231.44232000 should return 5. Thanks in advance.

How to use NSString from NSObject class in multiple Classes (View Controllers)

This question already has an answer here: What's the best way to communicate between view controllers? 4 answers

iOS project compilation

I am working on a project accessing web service. I found a project http://d1xzuxjlafny7l.cloudfront.net/downloads/PromoTest.zip The above code include JSON library [project setting compiler = LLVM 4.2] And I tried to use partial code of that project in my project. So I copied the JSON library into my project [my project uses Apple LLVM 3.1] and […]

How to swap between 2 root view controllers

I have a game with two rootViewControllers – one for the Menu and the other for the Game itself. When the user switches between the Game and the Menu, I want to switch the rootViewController. Ultimately my questions is, what is the best way to do this? Or is there another approach for switching stacks […]

Starting a SKProductsRequest gives – invalid selector error a moment later. LoadMicroPaymentsProductsOperation error

I’m fetching a list of identifiers from my server, then passing them off in a products request to Apple. Here’s my code, and below is the error I’m getting. The iPhone 4 is not crashing when this happens. -(void)didReceiveData:(NSArray *)data { NSLog(@”Received Identifiers: %@”,data); NSSet *productIdentifiers = [NSSet setWithArray:data]; SKProductsRequest *productsRequest = [[SKProductsRequest alloc] initWithProductIdentifiers:productIdentifiers]; […]

UILocationNotification not obeying daylight savings

I am scheduling local notifications like so + (void) addLocalNotification: (Event *) event { UILocalNotification *localNotif = [[UILocalNotification alloc] init]; localNotif.fireDate = event.scheduleTime; localNotif.alertBody = @”Time to apply drops\nPlease press view to see details”; localNotif.soundName = ALARM_SOUND_FILE; localNotif.timeZone = [NSTimeZone localTimeZone]; localNotif.applicationIconBadgeNumber = 1; NSDictionary * dict = [NSDictionary dictionaryWithObjectsAndKeys:event.number,LN_EVENT_KEY, ACTION_EVENT, LN_ACTION_KEY, nil]; localNotif.userInfo = […]

Max Image Width and Height in Xcode?

I could have sworn that I seen a while back that the max image size you can load into Xcode was 1024 x 1024, meaning you can’t use images that are larger than this, but I can’t remember where I seen it and I was hoping someone could verify or refute this statement for me? […]

keyboard hides textfield for different orientation in ipad

In my iPad application, I have few textView and textField’s. When I click on textField, the keyboard covers the textField. So I am implementing the below code to move the textview up. But on rotation to portraitUpsideDown its not working fine. It slides the screen down in opposite direction. So how do I solve this […]

how to change colour of loading icon

I want to change the colour of the loading icon that comes up after pulling to refresh this is my code for the indicatorviewstyle i think this is related to doing what i want but i didnt write the code, its from: https://github.com/Sephiroth87/ODRefreshControl -(void)setActivityIndicatorViewStyle: (UIActivityIndicatorViewStyle)activityIndicatorViewStyle { if ([_activity isKindOfClass:[UIActivityIndicatorView class]]) { [(UIActivityIndicatorView *)_activity setActivityIndicatorViewStyle:activityIndicatorViewStyle]; } […]

XCode compiler doesn't set my variable (and pointer) initial value to 0 or nil!

sthis is very annoying, since now my values are stored as if they contain somethin by default (like in c). All my OO stuff are now broken since my delegate are always somethin. I was wonderin why XCode do this to me, since by default XCode always set the variable value to 0 or nil. […]