Let's reveal the code!

Posts of ‘iOS’ category

Custom Animated Transition for Transparent Modal View Controller using Constraints

This is a complete example on how to display and dismiss a transparent modal view controller with a custom animated transition – from left to right – using autolayout constraints.

Transparent Modal View Custom Animated Transition

I used transition delegate which uses an animation transitioning controller to perform the display and the dismiss animations.

You can find the example project here:

Extend the navigation bar to status bar

Sometimes you may need to create a navigation bar for a view controller that is not part of navigation controller; like for example when display this view controller modally.

Then you will notice this navigation bar doesn’t extend to status bar.

So in your view controller implementation file, you should implement the following method of the UIBarPositioningDelegate .

Remember to add the following code to your view controller header file, to conform the class to UIBarPositioningDelegate protocol; because UINavigationBarDelegate extends UIBarPositioningDelegate.

Then back in your view controller implementation file, assign the delegate for the navigation bar in the viewDidLoad method assuming your navigation bar object called navBar.

detailTextLabel Disappear Issue

If you use UITableView with the cell style of Subtitle, you may need detailTextLabel to be empty in some cases.

Unfortunately setting the text of the detailTextLabel to empty string or nil seems to remove detailTextLabel from cell hierarchy. So after setting back the text of the detailTextLabel to some string value, the detailTextLabel will not appear in the cell any more.

You should write the following lines in order for the detailTextLabel to appear with the new text and to be in the desired position.