Posts Tagged ‘XCode’

Debugging EXEC_BAD_ACCESS on iPhone

Thursday, July 15th, 2010

Last night I had a problem with application crashing without obvious reason, I didn’t change much in code (I thought so). So a bit googling and I found solution written by codza how to debug this and find the source of the error.

Here is link to his blog post.

UIImageView is moving view to 0,0

Friday, July 2nd, 2010

Today I had weird problem while creating one iPhone application.

I have created one UIView and added one UIImageView to it and loaded it with Default.png image, but when starting the program whole view is moved up for 20px, it’s y reference is starting from 0 instead from 20, so here is how to fix it easily.

In application didFinishLaunching delegate add following code before [window makeKeyAndVisible]; and after [window addSubview:yourView];

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {

[window addSubview:yourView];
[yourView setFrame:CGRectMake(0, 20, 320, 460)]; // so you are creating frame which x starts on 0, y starts on 20px and with dimensions 320px x 460px
[window makeKeyAndVisible];

return YES;
}