Tag: cocoa touch

How to tint UIBarButtonItem background color?

I have a UIToolbar that contains 2 buttons. The toolbar has a tint: toolbar.tintColor = [UIColor colorWithRed:(102.0/255.0) green:(20.0/255.0) blue:(11.0/255.0) alpha:1]; How can I make the buttons have a similar tint color?

How to Dismiss 2 Modal View Controllers in Succession?

I have 2 view controllers presented modally. A presents B which presents C. When I dismiss C I would like to dismiss B as well. But I am not sure how to do this: Dismiss C: [self dismissModalViewControllerAnimated:YES] //[delegate dismissB] //this doesn’t work either when i create a delegate pattern Now I am left with […]

Problem dealloc'ing memory used by UIImageViews with fairly large image in an UIScrollView

I have a large UIScrollView into which I’m placing 3-4 rather large (320×1500 pixels or so) UIImageView image tiles. I’m adding these UIImageViews to the scroll view inside of my NIB files. I have one outlet on my controller, and that is to the UIScrollView. I’m using a property (nonatomic, retain) for this, and sythesizing […]

How to have a UIBarButtonItem with both image and text

When I try to use an image for a UIBarButtonItem, the text isn’t shown. Is there a way to show both the text and the image?

Split NSString multiple times on the same separator

I am currently receiving a string like this: @”Sam|26,Hannah|22,Adam|30,Carlie|32,Jan|54″ And I am splitting it like this: testArray = [[NSArray alloc] init]; NSString *testString = [[NSString alloc] initWithFormat:@”Sam|26,Hannah|22,Adam|30,Carlie|32,Jan|54,Steve|56,Matty|24,Bill|30,Rob|30,Jason|33,Mark|22,Stuart|54,Kevin|30″]; testArray = [testString componentsSeparatedByString:@”,”]; dict = [NSMutableDictionary dictionary]; for (NSString *s in testArray) { testArray2 = [s componentsSeparatedByString:@”|”]; [dict setObject:[testArray2 objectAtIndex:1] forKey:[testArray2 objectAtIndex:0]]; } I will now be […]

Better performance with libxml2 or NSXMLParser on the iPhone?

I’m curious what your solution is for high performance XML parsing on the iPhone is, given its limited amount of CPU power. I have reviewed the XML Performance App that Apple provides as a demonstration, and it seems that for the data feed (300 iTunes songs) that they’re parsing.. libxml2 always seem to come as […]

Objective C – How do I use initWithCoder method?

I have the following method for my class which intends to load a nib file and instantiate the object: – (id)initWithCoder:(NSCoder*)aDecoder { if(self = [super initWithCoder:aDecoder]) { // Do something } return self; } How does one instantiate an object of this class? What is this NSCoder? How can I create it? MyClass *class = […]

Create a table of contents from a pdf file

I’m using quartz to display pdf content, and I need to create a table of contents to navigate through the pdf. From reading Apple’s documentation I think I am supposed to use CGPDFDocumentGetCatalog, but I can’t find any examples on how to use this anywhere. Any ideas? Update: Still haven’t found a solution for this. […]

How to programmatically rotate image by 90 Degrees in iPhone?

Possible Duplicate: How to Rotate a UIImage 90 degrees? How to programmatically rotate image by 90 Degrees in iPhone?

Why is this dispatch_sync() call freezing?

I’m using the Kiwi testing framework to test an authentication method in my app. The test freezes at a call to dispatch_sync which looks like this: dispatch_queue_t main = dispatch_get_main_queue(); dispatch_sync(main, ^ { [[NSNotificationCenter defaultCenter] postNotificationName:kNotificationAuthenticationSuccess object:nil userInfo:ret]; }); I’d like to know why it freezes there, if anyone has any hints.