Can’t find momd file: Core Data problems

Here are a few recommendations: The code you posted to get the .mom(d) file is not exactly the recommended way. Use mergedModelFromBundles instead, as in self.managedObjectContent= [NSManagedObjectModel mergedModelFromBundles:nil]; It takes care of getting the path, choosing/merging the correct mom or momd, and initializing of the MOC all by one step. You should use this. But … Read more

How to use UIImagePickerController in iPad?

UIImagePickerController must be presented with UIPopoverController on iPad. if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPad) { UIPopoverController *popover = [[UIPopoverController alloc] initWithContentViewController:picker]; [popover presentPopoverFromRect:self.selectedImageView.bounds inView:self.selectedImageView permittedArrowDirections:UIPopoverArrowDirectionAny animated:YES]; self.popOver = popover; } else { [self presentModalViewController:picker animated:YES]; } EDIT: Add a strong property for the UIPopoverController: @property (nonatomic, strong) UIPopoverController *popOver; The popover should be dismissed in … Read more

Web site exhibits JavaScript error on iPad / iPhone under 3G but not under WiFi

I’ve investigated this further and discovered that the problem is that the UK mobile operator O2 (the original exclusive iPhone operator for Apple), modifies web content before sending it to iPhones and iPads. Probably before sending it to any device running a mobile browser. They non-deterministically inline some of the CSS and JavaScript into the … Read more

Interface orientation in iOS 6.0

Deprecated method in iOS 5: // Override to allow orientations other than the default portrait orientation. – (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { // Return YES for supported orientations return (interfaceOrientation == UIInterfaceOrientationLandscapeRight); } Replacement in iOS 6 and equivalent of this deprecated iOS 5 method above: – (BOOL) shouldAutorotate { return YES; } -(NSUInteger)supportedInterfaceOrientations { return UIInterfaceOrientationMaskLandscapeRight; } … Read more

How to know if a UITextField in iOS has blank spaces

You can “trim” the text, that is remove all the whitespace at the start and end. If all that’s left is an empty string, then only whitespace (or nothing) was entered. NSString *rawString = [textField text]; NSCharacterSet *whitespace = [NSCharacterSet whitespaceAndNewlineCharacterSet]; NSString *trimmed = [rawString stringByTrimmingCharactersInSet:whitespace]; if ([trimmed length] == 0) { // Text was … Read more

How to know if a UITextField in iOS has blank spaces

You can “trim” the text, that is remove all the whitespace at the start and end. If all that’s left is an empty string, then only whitespace (or nothing) was entered. NSString *rawString = [textField text]; NSCharacterSet *whitespace = [NSCharacterSet whitespaceAndNewlineCharacterSet]; NSString *trimmed = [rawString stringByTrimmingCharactersInSet:whitespace]; if ([trimmed length] == 0) { // Text was … Read more

iPhone : How to set BackgroundColor of UIButton with buttonType UIButtonTypeCustom

You could create an image programmatically and so have the ability to use your colors in a dynamic way: Create a category for UIButton with this method and be sure to have QuartzCore lib imported via @import QuartzCore: – (void)setColor:(UIColor *)color forState:(UIControlState)state { UIView *colorView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 1, 1)]; colorView.backgroundColor = color; … Read more