Tag: objective c

Adding delay between execution of two following lines

I need to add delay between the execution of two lines in a(same) function. Is there is any favorable options to do this? Note: I don’t need two different functions to do this, and the delay must not affect other functions’ execution. eg: line 1: [executing first operation]; line 2: Delay /* I need to […]

What does @dynamic do in Objective-C?

This question already has an answer here: @synthesize vs @dynamic, what are the differences? 8 answers

Check if iOS app is in background

I want to check if the app is running in the background. In: locationManagerDidUpdateLocation { if(app is runing in background){ do this } }

Cocoa: Checks required for multiple asynchronous NSURLConnections using same delegate functions?

This is with reference to the StackOverflow question Managing multiple asynchronous NSURLConnection connections I have multiple asynchronous HTTP requests being made at the same time. All these use the same NSURLConnection delegate functions. (The receivedData object is different for each connection as specified in the other question above. In the delegate, I parse the receivedDate […]

How to implement UIScrollView with 1000+ subviews?

I am struggling with writing portion of an app which should behave like the native iphone photo app. Looked at iphone sdk app development book from Orielly which gave an example code for implementing this so-called page-flicking. The code there first created all subviews and then hide/unhide them. At a given time only 3 subviews […]

iOS 5 storyboard, programmatically determine path

I’m having trouble to achieve the following using a storyboard: When setup is not done: run app -> show settings view controller -> show main navigation controller When setup is done: run app -> show main navigation controller So basically, I want the app to programmatically start with the settings view in certain cases, and […]

How to Make a Basic Finite State Machine in Objective-C

I am attempting to build an FSM to control a timer in (iphone sdk) objective c. I felt it was a necessary step, because I was otherwise ending up with nasty spaghetti code containing pages of if-then statements. The complexity, non-readability, and difficulty of adding/changing features lead me to attempt a more formal solution like […]

Can we customize the page indicator in UIPageViewController?

Now it’s white dots with black background. What about if I want it to be black dots with white backgrounds? – (NSInteger)presentationCountForPageViewController:(UIPageViewController *)pageViewController NS_AVAILABLE_IOS(6_0) { return _imageArrays.count; }// The number of items reflected in the page indicator. – (NSInteger)presentationIndexForPageViewController:(UIPageViewController *)pageViewController NS_AVAILABLE_IOS(6_0) { return self.intCurrentIndex; }// The selected item reflected in the page indicator.

How to convert std::string to NSString?

Hi I am trying to convert a standard std::string into an NSString but I’m not having much luck. I can convert successfully from an NSString to a std::string with the following code NSString *realm = @”Hollywood”; std::string REALM = [realm cStringUsingEncoding:[NSString defaultCStringEncoding]]; However I get a compile time error when I try the following NSString […]

How can I dynamically create a selector at runtime with Objective-C?

I know how to create a SEL at compile time using @selector(MyMethodName:) but what I want to do is create a selector dynamically from an NSString. Is this even possible? What I can do: SEL selector = @selector(doWork:); [myobj respondsToSelector:selector]; What I want to do: (pseudo code, this obviously doesn’t work) SEL selector = selectorFromString(@”doWork”); […]