Presenting a UIAlertController properly on an iPad using iOS 8

You can present a UIAlertController from a popover by using UIPopoverPresentationController. In Obj-C: UIViewController *self; // code assumes you’re in a view controller UIButton *button; // the button you want to show the popup sheet from UIAlertController *alertController; UIAlertAction *destroyAction; UIAlertAction *otherAction; alertController = [UIAlertController alertControllerWithTitle:nil message:nil preferredStyle:UIAlertControllerStyleActionSheet]; destroyAction = [UIAlertAction actionWithTitle:@”Remove All Data” style:UIAlertActionStyleDestructive … Read more

How to fix UITableView separator on iOS 7? [duplicate]

UITableView has a property separatorInset. You can use that to set the insets of the table view separators to zero to let them span the full width of the screen. [tableView setSeparatorInset:UIEdgeInsetsZero]; Note: If your app is also targeting other iOS versions, you should check for the availability of this property before calling it by … Read more

Converting Storyboard from iPhone to iPad

I found out a kind of solution: Duplicate your iPhone-Storyboard and rename it MainStoryboard_iPad.storyboard Close Xcode and then open this file any text editor. Search for targetRuntime=”iOS.CocoaTouch”and change it to targetRuntime=”iOS.CocoaTouch.iPad” Change the code in the MainStoryboard_iPad.storyboard from: <simulatedScreenMetrics key=”destination” type=”retina4″/> to <simulatedScreenMetrics key=”destination”/> Now save everything and reopen Xcode. The iPad-Storyboard has the same … Read more

How to get device make and model on iOS?

EITHER try this library: http://github.com/erica/uidevice-extension/ (by Erica Sadun). (The library is 7-8 years old, and hence is obsolete) (Sample Code): [[UIDevice currentDevice] platformType] // ex: UIDevice4GiPhone [[UIDevice currentDevice] platformString] // ex: @”iPhone 4G” OR You can use this method: You can get the device model number using uname from sys/utsname.h. For example: Objective-C #import <sys/utsname.h> … Read more

iOS detect if user is on an iPad

There are quite a few ways to check if a device is an iPad. This is my favorite way to check whether the device is in fact an iPad: if ( UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad ) { return YES; /* Device is iPad */ } The way I use it #define IDIOM UI_USER_INTERFACE_IDIOM() #define IPAD UIUserInterfaceIdiomPad … Read more

Detect current device with UI_USER_INTERFACE_IDIOM() in Swift

When working with Swift, you can use the enum UIUserInterfaceIdiom, defined as: enum UIUserInterfaceIdiom : Int { case unspecified case phone // iPhone and iPod touch style UI case pad // iPad style UI (also includes macOS Catalyst) } So you can use it as: UIDevice.current.userInterfaceIdiom == .pad UIDevice.current.userInterfaceIdiom == .phone UIDevice.current.userInterfaceIdiom == .unspecified Or … Read more

iPhone App Icons – Exact Radius?

You can make four icons (as of today) for your app and they can all have a different look – not necessarily based on the 512×512 image. corner radius for the 512×512 icon = 80 (iTunesArtwork) corner radius for the 1024×1024 icon = 180 (iTunesArtwork Retina) corner radius for the 57×57 icon = 9 (iPhone/iPod … Read more

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