iOS Development is easy with XCode, Swift3, UITableView, cocatouch, let's build iPhone, iPad and Macbook Applications.

How can I detect screen lock/unlock events on the iPhone?

How can I detect screen lock/unlock events on the iPhone? When the user unlocks it, I want to show a notification alert from my iPhone app. (For Just like Broadcast Receiver for screen unlock in Android.)

Adding custom fonts to iOS app finding their real names

I have two fonts to add in my app for using. Here is the font images. Currently the files are named as name.font = [UIFont fontWithName:@”Helvetica Neue LT Pro-Medium” size:10]; headline.font = [UIFont fontWithName:@”Helvetica Neue LT Pro-Light” size:8]; putting same name in the Font Avaliable option in plist file. I have also tried adding file […]

iOS 10.3: NSStrikethroughStyleAttributeName is not rendered if applied to a sub range of NSMutableAttributedString

A strikethrough (single, double, …) added as attribute to an instance of NSMutableAttributedString is not rendered if the apply range is not the whole string range. This happens using addAttribute(_ name: String, value: Any, range: NSRange), insert(_ attrString: NSAttributedString, at loc: Int), append(_ attrString: NSAttributedString), … Broken by Apple in early iOS 10.3 betas, and […]

Making text bold using attributed string in swift

I have a string like this var str = “@text1 this is good @text1″ Now replace the text1 with another string, say “t 1” I am able to replace the text, but i am not able to bold it. I want to bold the new string “t 1”. So that the final output will be […]

iOS – color on xcode simulator is different from the color on device

Overview The background color of my iPhone app in the simulator (iMac) looks different from the color on the device (iPhone 3GS). EDIT (following section has been added) The following are all different: story board color (xib file) simulator color device color I suppose I should go with how it looks on the device. Questions […]

UIButton Image + Text IOS

I need a UIButton with image & text. Image should be in the top & text comes under the image both should be clickable.

Xcode, where to assign the segue identifier

Pardon me for beginner’s question in Swift 2. I know I can switch to another screen (ViewController) like this self.performSegueWithIdentifier (“SecondViewController”, sender: self) but I can’t seem to find where to assign my 2nd screen the id, I just find Storyboard ID, is that it? I’ve already tried, only received a crash with the following […]

iOS 5 Twitter Framework: Tweeting without user input and confirmation (modal view controller)

Essentially what I want is for the app, once the user has allowed access to their Twitter account, to be able to tweet whatever the user has selected in a UITableView. Ideally I’d like to use the Twitter framework in iOS 5, but the main issue I’m having is the modal view controller for tweeting. […]

UICollectionView reloadData not functioning properly in iOS 7

I’ve been updating my apps to run on iOS 7 which is going smoothly for the most part. I have noticed in more than one app that the reloadData method of a UICollectionViewController isn’t acting quite how it used to. I’ll load the UICollectionViewController, populate the UICollectionView with some data as normal. This works great […]

NSFetchedResultsController v.s. UILocalizedIndexedCollation

I am trying to use a FRC with mixed language data and want to have a section index. It seems like from the documentation you should be able to override the FRC’s – (NSString *)sectionIndexTitleForSectionName:(NSString *)sectionName – (NSArray *)sectionIndexTitles and then use the UILocalizedIndexedCollation to have a localized index and sections. But sadly this does […]