What is Protocol Oriented Programming in Swift? What added value does it bring?

Preface: POP and OOP are not mutually exclusive. They’re design paradigms that are greatly related. The primary aspect of POP over OOP is that is prefers composition over inheritance. There are several benefits to this. In large inheritance hierarchies, the ancestor classes tend to contain most of the (generalized) functionality, with the leaf subclasses making … Read more

difference between presentViewController and UINavigationController?

presentViewController offers a mechanism to display a so-called modal view controller; i.e., a view controller that will take full control of your UI by being superimposed on top of a presenting controller. UINavigationController offers a much more flexible mechanism where you can push a new controller, and later pop it, so to go back to … Read more

Restore pre-iOS7 UINavigationController pushViewController animation

I managed to workaround the new transition type by creating a category for UINavigationController. In my case I needed to revert it to the old transition style because I have transparent viewControllers that slide over a static background. UINavigationController+Retro.h @interface UINavigationController (Retro) – (void)pushViewControllerRetro:(UIViewController *)viewController; – (void)popViewControllerRetro; @end UINavigationController+Retro.m #import “UINavigationController+Retro.h” @implementation UINavigationController (Retro) – … Read more

how to increase font size in UIWebView

I have 2 buttons – A- and A+ @interface NSUInteger textFontSize; – (IBAction)changeTextFontSize:(id)sender { switch ([sender tag]) { case 1: // A- textFontSize = (textFontSize > 50) ? textFontSize -5 : textFontSize; break; case 2: // A+ textFontSize = (textFontSize < 160) ? textFontSize +5 : textFontSize; break; } NSString *jsString = [[NSString alloc] initWithFormat:@”document.getElementsByTagName(‘body’)[0].style.webkitTextSizeAdjust=”%d%%””, … Read more

How can I disable landscape orientation?

To disable orientations for a particular View Controller, you should now override supportedInterfaceOrientations and preferredInterfaceOrientationForPresentation. – (UIInterfaceOrientationMask)supportedInterfaceOrientations { // Return a bitmask of supported orientations. If you need more, // use bitwise or (see the commented return). return UIInterfaceOrientationMaskPortrait; // return UIInterfaceOrientationMaskPortrait | UIInterfaceOrientationMaskPortraitUpsideDown; } – (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation { // Return the orientation you’d prefer – … Read more