Can I mix UIKit and TVMLKit within one app?

Yes, you can. Displaying TVML templates requires you to use an object that controls the JavaScript Context: TVApplicationController. var appController: TVApplicationController? This object has a UINavigationController property associated with it. So whenever you see fit, you can call: let myViewController = UIViewController() self.appController?.navigationController.pushViewController(myViewController, animated: true) This allows you to push a Custom UIKit viewcontroller onto … Read more

adding images to UItableView

A custom UITableViewCell is not required to simply add an image to the left side of the cell. Simply configure the imageView property of the UITableView cell in your tableView:cellForRowAtIndexPath: delegate method like so: – (UITableViewCell*)tableView:(UITableView*)tableView cellForRowAtIndexPath:(NSIndexPath*)indexPath { static NSString* CellIdentifier = @”Cell”; UITableViewCell* cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier]; if (cell == nil) cell = [[[UITableViewCell … Read more

Switching ViewControllers with UISegmentedControl in iOS5

This code works pretty well for your purpose, I use it for one of my new apps. It uses the new UIViewController containment APIs that allow UIViewControllers inside your own UIViewControllers without the hassles of manually forwarding stuff like viewDidAppear: – (void)viewDidLoad { [super viewDidLoad]; // add viewController so you can switch them later. UIViewController … Read more

How to hide UITabBar?

You have to use set the hidesBottomBarWhenPushed property to YES on the controller that you are pushing and NOT to the UITabBarController. otherController.hidesBottomBarWhenPushed = YES; [navigationController pushViewController: otherController animated: TRUE]; Or you can set the property when you first initialize the controller you want to push.

iOS 9 UITableView separators insets (significant left margin)

Okay, I have found out the solution. The only thing required for that is to set on the presenting instance of UITableView that flag cellLayoutMarginsFollowReadableWidth myTableView.cellLayoutMarginsFollowReadableWidth = NO; I wanted to find some reference in the documentation but it looks like it is not ready yet, only mentioned on diff page. As the flag was … Read more

Detect backspace Event in UITextField

Swift 4.2 func textField(textField: UITextField, shouldChangeCharactersInRange range: NSRange, replacementString string: String) -> Bool { if let char = string.cString(using: String.Encoding.utf8) { let isBackSpace = strcmp(char, “\\b”) if (isBackSpace == -92) { print(“Backspace was pressed”) } } return true } Older Swift version func textField(textField: UITextField, shouldChangeCharactersInRange range: NSRange, replacementString string: String) -> Bool { let … Read more

How to do a native “Pulse effect” animation on a UIButton – iOS

CABasicAnimation *theAnimation; theAnimation=[CABasicAnimation animationWithKeyPath:@”opacity”]; theAnimation.duration=1.0; theAnimation.repeatCount=HUGE_VALF; theAnimation.autoreverses=YES; theAnimation.fromValue=[NSNumber numberWithFloat:1.0]; theAnimation.toValue=[NSNumber numberWithFloat:0.0]; [theLayer addAnimation:theAnimation forKey:@”animateOpacity”]; //myButton.layer instead of Swift let pulseAnimation = CABasicAnimation(keyPath: #keyPath(CALayer.opacity)) pulseAnimation.duration = 1 pulseAnimation.fromValue = 0 pulseAnimation.toValue = 1 pulseAnimation.timingFunction = CAMediaTimingFunction(name: CAMediaTimingFunctionName.easeInEaseOut) pulseAnimation.autoreverses = true pulseAnimation.repeatCount = .greatestFiniteMagnitude view.layer.add(pulseAnimation, forKey: “animateOpacity”) See the article “Animating Layer Content”

UIFont – how to get system thin font

You can use system font thin weight: UIFont.systemFont(ofSize: 34, weight: UIFontWeightThin) List of available weights for San Francisco: UIFontWeightUltraLight UIFontWeightThin UIFontWeightLight UIFontWeightRegular UIFontWeightMedium UIFontWeightSemibold UIFontWeightBold UIFontWeightHeavy UIFontWeightBlack As of iOS 11, UIFontWeight* was renamed to UIFont.Weight.*. More you can get here https://developer.apple.com/documentation/uikit/uifont.weight.