Tag: cocoa touch

UIActionSheet cancel button strange behaviour

I have a UIBarButtonItem opening an action sheet to offer users choices about what to do. Everything works as expected unless I try to click on the “Cancel” button. The target of the button appears to have moved up from where it should be. I can only activate it by clicking somewhere in the middle […]

How do I convert NSMutableArray to NSArray?

How do I convert NSMutableArray to NSArray in objective-c?

Getting an array of a property from an object array

I need to extract an array of a single property from a custom object array. eg. @interface MyClass : NSObject { int sampleNumber; NSString *sampleName; } I have an array of MyClass instances called myArray. I want to then get an array of the sampleName strings. Is there a way to do it without stepping […]

Why is 'no known method for selector x' a hard error under ARC?

Maybe it’s useful if calling a method that MyClass doesn’t understand on a something typed MyClass is an error rather than a warning since it’s probably either a mistake or going to cause mistakes in the future… However, why is this error specific to ARC? ARC decides what it needs to retain/release/autorelease based on the […]

Transitioning to landscape rotation within a uinavigationcontroller

I want to push a landscape view from within a uinaviagtioncontroller, whose initial view is in portrait… So you click a button, or tableviewcell, and the screen rotates 90° into the new view.. How would I manage that? This is similar to how the Youtube app works when transitioning from movie info screen to the […]

Shifting view after displaying modal – possibly AutoLayout related

I present a simple view with a couple of labels and a button, all inside a UIScrollView and laid out using auto layout. The button presents another view, which includes a navigation item for dismissal. After dismissal, though, the content of the original UIScrollView is offset. Strangely, the amount by which it is offset seems […]

dispatch_sync() always execute block in main thread

Is there any difference between if dispatch_sync is called in 3 different queue like 1. dispatch_sync(dispatch_get_main_queue(),^(void){ NSLog(@”this execute in main thread”) // via [NSThread isMainThread] }); 2. dispatch_sync(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_HIGH, 0), ^(void){ NSLog(@”this also execute in main thread”) // via [NSThread isMainThread] } 3. dispatch_queue_t queue; queue = dispatch_queue_create(“com.example.MyQueue”, NULL); dispatch_sync(queue, ^(void){ NSLog(@”this also execute in main […]

Looping using NSRange

I’m trying to use NSRange to hold a range of years, such as NSRange years = NSMakeRange(2011, 5); I know NSRange is used mostly for filtering, however I want to loop over the elements in the range. Is that possible without converting the NSRange into a NSArray?

Customizing Section indexes in UITableView in iphone application

Does any one have tried to customize default section index displayed in UITableView. I want to modify the appearance of UITableView SectionIndex. Is it possible to customize it ? Is there any delegate methods available for this ? What delegate methods should I use – if above question’s answer is yes? I have uploaded an […]

Learning iPhone SDK (Objective-C)

Hey programmers! I really want to learn how to program really cool games and iphone apps but unfortunately, I don’t know Objective-C. My school only offers Java courses (which I’m not fond of) and I really want to take a class or get a tutor. ANYTHING SO I CAN LEARN THIS LANGUAGE. I’ve got great […]