cocoa-touch

Where to #include?

In my past applications I have been #importing into my *.h files where needed. I have not really thought much about this before as I have not had any problems, but today I spotted something that got me to thinking that maybe I should be #import-ing into my .m files and using @class where needed in the headers (.h) Can anyone shine any li...

Dump UIImage on iPhone

I wonder how to save the UIImage object from UIImagePickerController into the App Document directory. I tried to use UIImageJPEGRepresentation() method and UIImagePNGRepresentation(), but it seemed the image data was changed. Is there any method to keep the original image content without any compression? ...

http authenitcation in Xcode

I am trying to make Twitter work in my app and everything works fine except the code does not seem to recognize an error from Twitter. If the username/password are not valid, I get an error message through this function: - (void)connection:(NSURLConnection *)connection didReceiveData:(NSData *)data { NSString* strData = [[[NSString al...

AutoreleasePool in UIApplication Loop

Hello, i have an app that starts with the default code for iPhone Apps: NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init]; int retVal = UIApplicationMain(argc, argv, nil, nil); [pool release]; Cause my app never stopps, the [pool release] is never called. Has the standard UI loop of UIApplicationMain an own AutoreleasePool ...

Building a list of favorites from Core Data

I'm building an app with two tabs. The first tab has a main tableview that connects to a detail view of the row. The second tab will display a tableView based on the user adding content to it by tapping a button on the detail view. My question is this. What is the correct design pattern to do this? Do I create a second ManagedObjectCont...

One table view cell/row bigger than others? (iphone, cocoa-touch)

I know it is possible to set the height of all rows in a UITable but is it possible to set one row to be bigger than the others. For example when the user touches on the cell with 2 fingers I want the cell to expand and show a description. But only that cell. Is that possible without overlapping the cells below it? ...

set Image to Button

Hello all, Could somebody help me a little bit with my issue below? When I call the myFunction, images which I want to set to buttons appear after 2 sec simultaneously, not one by one with delay of 0.5 sec. More info: generatedNumbers is array with four elements of NSNumber (4,1,3,2) buttons are set in UIView via IB and are tagged...

Validating UITextField input and displaying error

What's the best practice for validating user input in a UITextField and displaying error? I tried performing checks inside textFieldShouldReturn and textFieldShouldEndEditing and popping up an error box when userever inputted invalid content. However, during testing, the popup from textFieldShouldEndEditing is getting invoked multiple ...

Disable UITableView vertical bounces when scrolling

How do I disable the bounce effect when vertically scrolling a UITableView? Right now if I scroll anywhere near the bottom, the view scrollbar bounces right up. I would like my UITableView to stay fixed at the scrolled-to position instead of bouncing back up. ...

Signature invalid only for ad hoc

I'm not sure what changed on my ad hocs but I get this error when trying to install: Application failed codesign verification. The signature was invalid, or it was not signed with an Apple submission certificate. (-19011) Device debug builds fine. The cert that is associated with my ad hoc provisioning profile doesn't expire until 2011...

Custom UIToolBar from Images

I need to create a UIToolbar object that uses an image for the background. Most of the buttons are images as well, and rectangular. One button, however, is round and overlaps the toolbar like the Start button on the Windows task bar. See below. I know that I will need to subclass the UIToolbar to paint the image for the toolbar -- I thi...

iPhone Foundation - performance implications of mutable and xxxWithCapacity:0

All of the collection classes have two versions - mutable and immutable, such as NSArray and NSMutableArray. Is the distinction merely to promote careful programming by providing a const collection or is there some performance hit when using a mutable object as opposed to immutable? Similarly each of the collection classes has a method ...

Finding text's bounding rect in Core Text

I'm trying to find the boundaries of a line of text in Core Text. For simplicity, assume it has a single character. At the moment I'm using the following method: line = CTLineCreateWithAttributedString(attrString); rect = CTLineGetImageBounds(line, context); It works most of the times, but for some characters, like math italic d (Unic...

How to backup data stored with Core Data - iPhone app?

I'm using sqlite for the persistent store, so could I just upload the .sqlite file to, for example, Amazon S3 as a way of providing users with the ability to backup their app data? Then for restoring just download it back and replace the existing .sqlite file in the app's folder. Does anybody see any issues with that? Has anyone done it...

UITableViewCell outside of UITableView

I notice that InterfaceBuilder has UITableViewCell in its library of objects I can drag onto a view. I wonder if it ever makes sense to use one outside of a UITableView. ...

How can we add scrolling text in cocos2d by using UITextView ?

I want a UITextView in cocos2d. I used in init method I wrote the code , UITextView *textView = [[UITextView alloc] initWithFrame:CGRectMake(0,0, windowSize.height/2,windowSize.width/2)]; textView.backgroundColor = [UIColor clearColor]; textView.text = @"I am First enemy"; [textView setEditable:NO]; [[[CCDirector sharedDirect...

How to have a UIView on top of TabBar?

How can I get my UIPickerView to apear on top of the TabBar? http://bit.ly/aSFKYY This is a TabBar Application and that NIB file contain 2 views That I animate to show / hide instead of the keyboard, but the keyboard animates on top of all UIViews. How can I accomplish this with my Custom View? ...

How do I associate file types with an iPhone application?

On the subject of associating your iPhone app with file types. In this informative question I learned that apps could be associated with custom URL protocols. That was almost one year ago and since then Apple introduced 'Document Support' which goes a step further and allows apps to associate with file types. There is a lot of talk in...

Why is my view not resizing after rotating?

I'm only supporting the portrait orientation, but both the right-side-up and upside-down versions. Why do my subviews not resize appropriately? There's a status bar sized black space at the top of the view. If I change tabs and come back, it's corrected. ...

Autorelease vs. Release

Given the two scenarios, which code is best practice and why? Autorelease loginButton = [[[UIBarButtonItem alloc] initWithTitle:@"Login" style:UIBarButtonItemStylePlain target:self action:@s...