iphone

Inherent UIView leak

When ran in activity monitor, the real memory usage for a program running the following piece of code will increase endlessly: CGRect frame = CGRectMake(0,0,0,0); while(true) { NSAutoreleasePool *pool = [NSAutoreleasePool new]; UIView *test = [[UIView alloc] initWithFrame:frame]; [test release]; [pool release]; } What ...

What does the & symbol mean in Objective-C?

What does the & symbol mean in Objective-C? I am currently looking at data constucts and am getting really confused by it. I have looked around the web for it but have not found an answer at all. I know this is possibly a basic Objective-C concept, but I just can't get my head around it. For example: int *pIntData = (int *)&incomingPa...

Do all class methods return an autoreleased object?

I'm re-reading the first few chapters of Cocoa Programming for Mac OS X and the author states that one of NSCalendarDate's class method returns an autoreleased object. I always assumed that all class methods returned an autoreleased object (since there's no alloc involved). Are there any class methods which you have to specifically reta...

iPhone: is it worth developing an application to support the OS 2.2 anymore?

The new OS (3.0+) adds more features which speed up the development (like working with the lists etc). On the other hand there could be (potentially) a lot of users somewhere still running OS 2.2. Is there any place to look for statistics? Could someone offer an advice on the target OS for a new iPhone app scheduled for Christmas releas...

UIButton Game character selection to UIImageView animation

Hi guys, I am almost at the end of coding my kids educational application, woohoo!. But... Im stuck on something. When app loads i have my main view. It has 4 buttons for flipviews(each with ten views of content) and 4 buttons for character selection(an image that will follow you through every screen of content). Problem is im unsure...

What OSX/XCode version control system should I use for iPhone development?

I've been developing my first iPhone app part-time and would like to start using a more rigorous form of version control than I've been using over the past four months, i.e. copying source code folders to another directory and time stamping them. I've used SourceSafe and Team Foundation System but I don't have a good idea of what versio...

App on Dev iPhone Not Starting on Certain Network Operators

Hi all, We develop iPhone apps in Europe and sometimes we demo them in the USA using our dev iPhones that we bring with us. Our apps connect to our services (server-side apps) to pull data to operate. We recently noticed something strange. Depending on the carrier that we select as network operator our app may not work. It just doesn't ...

How to change a date by changing AM / PM hours period in 12h format?

In the docs, Apple gives an example on how to add some hours and minutes to an existing date: NSDate *today = [NSDate date]; NSDateComponents *offsetComponents = [[NSDateComponents alloc] init]; [offsetComponents setHour:1]; [offsetComponents setMinutes:30]; NSDate *endOfWorldWar3 = [gregorian dateByAddingComponents:comps toDate:today o...

Secure way to figure out if a given date format has an 12h or 24h format?

I know this sucks. Date stuff sucks hard. But: Imagine a date format like "dd-MM-yyyy h:mm" how would you tell for sure what time mode that is? AM / PM or 24 hour? I'd say: If there is no "a" in the date format, then that's no AM / PM stuff and therefore it's nice 24h stuff. What do you think? ...

How do I create a basic UIButton programmatically?

How can I create basic UIButton programmatically? For example in my view controller, when executing the viewDidLoad method, a three UIButton will create dynamically and set its layout or properties. ...

NSURLConnection works on simulator but fails on iphone device

I'm testing iphone application via xCode both simulation and on iphone device. On the simulation, there is no problem, but when running on the iphone device, NSURLConnection fails, connection:didFailWithError: method called. What can be the reason for this problem? ...

Merging 2 Xcode projects - two AppDelegates causing errors

I have two Xcode iPhone projects I want to merge. Both have viewcontrollers, xibs and appdelegates. I have merged them but have over a dozen fatal errors, largely about one of the appdelegates. I went into info.plist and changed the main nib from the first project to the second but am still getting the errors about the second projec...

NSURLConnection "lost network connection" error ?

Hello, I am developing an app that will upload the image from the iphone to a server. In server side there is a php program to handle the uploaded image. I am using the NSURLConnection with the Post method and have set the post body of the request. When I upload the image, I could see the image uploaded 3 times(in the server), but after...

Obj-C... "Incompatible types in initialization" error

My code: CGPoint *tp_1 = CGPointMake(160, 240); gives an "Incompatible types in initialization" error... why is this?? ...

UIImageWriteToSavedPhotosAlbum saves to wrong size and quality

Hi, I'm trying to take a screen shot of my app's current view and save it to photo album (to then be emailed or MMS'ed). UIGraphicsBeginImageContext(self.view.bounds.size); [self.view.layer renderInContext:UIGraphicsGetCurrentContext()]; UIImage *viewImage = UIGraphicsGetImageFromCurrentImageContext(); UIGraphicsEndImageContext(...

How to find performance bottlenecks in an iPhone app?

I feel my app has bad performance, and want to figure out which parts in code are evil. Is there a good tutorial somewhere on how to find these? ...

MKMapView not calling delegate methods

In a UIViewController I add a MKMapView to the view controlled by the controller. - (void)viewDidLoad { [super viewDidLoad]; CGRect rect = CGRectMake(0, 0, 460, 320); map = [[MKMapView alloc] initWithFrame:rect]; map.delegate = self; [self.view addSubview:map]; } Later in the controller I have - (void)mapViewDidFinishLoadingMap:(MKM...

iPhone app launch in landscape mode. Why the obscure warning?

I want to launch my app in landscape mode and I am following the steps describe here: http://developer.apple.com/iphone/library/technotes/tn2009/tn2244.html To summerize: In my ViewController: - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { return (interfaceOrientation == UIInterfaceO...

iPhone UIWebView epubs split page by page

It's really interesting how book reading applications like Stanza or Eucalyptus split epubs which is html by page so lines are clear and next page starts at the correct line. Does anyone has any idea how this could be accomplished? ...

UITableViewCellStyleValue2 edit indicators?

I am using this style of table view UITableViewCellStyleValue2. I set editing, but I cant seem to get the arrows to show up on the right of the cell - like the Contacts app. Also in the contacts app I notice that if I have a Favorite it puts a * (star) to the right. Any info on how to get an image would be appreciated. Thanks! ...