New image name for iPhone 5

No special suffix for iPhone 5 (4” display), just the specific Default-568h@2x.png file. Here’s a macro to handle it: // iPhone 5 support #define ASSET_BY_SCREEN_HEIGHT(regular, longScreen) (([[UIScreen mainScreen] bounds].size.height <= 480.0) ? regular : longScreen) Usage: (assets names – image.png, image@2x.png, image-568h@2x.png) myImage = [UIImage imageNamed:ASSET_BY_SCREEN_HEIGHT(@”image”,@”image-568h”)];

UIActivityViewController – Email and Twitter sharing

For adding subject to the email using UIActivityViewController on iOS6, this is the best solution that anyone can use.. All you have to do is call the following while initializing UIActivityViewController. UIActivityViewController *activityViewController = [[UIActivityViewController alloc] initWithActivityItems:activityItems applicationActivities:applicationActivities]; [activityViewController setValue:@”My Subject Text” forKey:@”subject”]; And your UIActivityViewController is populated with a subject.

Where to highlight UICollectionViewCell: delegate or cell?

As the documentation says, you can rely on highlighted property to be changed while the cell is highlighted. For example the following code will make the cell red when highlighted (not its subviews though): – (void)setHighlighted:(BOOL)highlighted { [super setHighlighted:highlighted]; [self setNeedsDisplay]; } – (void)drawRect:(CGRect)rect { [super drawRect:rect]; if (self.highlighted) { CGContextRef context = UIGraphicsGetCurrentContext(); CGContextSetRGBFillColor(context, … Read more

MFMailComposeViewController throws a viewServiceDidTerminateWithError and then exits when using a custom title font

Setting a custom font for the UITextAttributeFont to the titleTestAttributes of the UINavigationBar appearance proxy causes the bug as the OP and MightlyLeader identified. Workaround Code: // remove the custom nav bar font NSMutableDictionary* navBarTitleAttributes = [[UINavigationBar appearance] titleTextAttributes].mutableCopy; UIFont* navBarTitleFont = navBarTitleAttributes[UITextAttributeFont]; navBarTitleAttributes[UITextAttributeFont] = [UIFont systemFontOfSize:navBarTitleFont.pointSize]; [[UINavigationBar appearance] setTitleTextAttributes:navBarTitleAttributes]; // set up and present … Read more

Xcode 4.5 command line unit testing

Just thought I should also share what I did for a solution to this issue. I followed the solution outlined in https://stackoverflow.com/a/10823483/666943 but converted the ruby script to shell. At the end I basically installed ios-sim via homebrew and replace the Run Script in the Build Phases of my Test target with the following: if … Read more

iOS 6 rotations: supportedInterfaceOrientations doesn´t work?

If your ViewController is a child of a UINavigationController or UITabBarController, then it is the parent that is your problem. You might need to subclass that parent view controller, just overriding those InterfaceOrientation methods as you’ve shown in your question EDIT: Example for portrait only TabBarController @interface MyTabBarController : UITabBarController { } @end @implementation MyTabBarController … Read more

Attempt to present * on * whose view is not in the window hierarchy

You can’t display a modal view controller from the appDelegate. You need to display a modal ViewController from whichever viewController is currently displaying full-screen. In other words, you need to put that code into your root view controller, or whichever one you want to display the modal vc from… Also, you’ll want to use the … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)