NavigationBar bar, tint, and title text color in iOS 8

The background text in the status bar is still black. How do I change the color to white? // io8, swift, Xcode 6.0.1 override func viewDidLoad() { super.viewDidLoad() self.navigationController?.navigationBar.barTintColor = UIColor.blackColor() self.navigationController?.navigationBar.titleTextAttributes = [NSForegroundColorAttributeName: UIColor.orangeColor()] } 18 Answers 18

How to call gesture tap on UIView programmatically in swift

I have a UIView and and I have added tap gesture to it: let tap = UITapGestureRecognizer(target: self, action: Selector(“handleTap:”)) tap.delegate = self myView.addGesture(tap) I am trying to call it programmatically in the testfile. sendActionForEvent I am using this function, but it is not working: myView.sendActionForEvent(UIEvents.touchUpDown) It shows unrecognised selector sent to instance. How can … Read more

registerForRemoteNotificationTypes: is not supported in iOS 8.0 and later

When trying to register for push notifications under iOS 8.x: application.registerForRemoteNotificationTypes(UIRemoteNotificationType.Alert | UIRemoteNotificationType.Badge | UIRemoteNotificationType.Sound) I get the following error: registerForRemoteNotificationTypes: is not supported in iOS 8.0 and later. Any ideas what is the new way of doing it? It does work when I run this Swift app on iOS 7.x. EDIT On iOS 7.x … Read more

Changing the Status Bar Color for specific ViewControllers using Swift in iOS8

override func preferredStatusBarStyle() -> UIStatusBarStyle { return UIStatusBarStyle.LightContent; } Using the above code in any ViewController to set the statusBar color to White for a specific viewcontroller doesnt work in iOS8 for me. Any suggestions? Using the UIApplication.sharedApplication method, the color changes after required changes in the Info.plist for the whole app. // Change the … Read more

iOS 8 Snapshotting a view that has not been rendered results in an empty snapshot

In iOS 8 I am having problem capturing images from camera till now I am using this code for UIImagePickerController *controller=[[UIImagePickerController alloc] init]; controller.videoQuality=UIImagePickerControllerQualityTypeMedium; controller.delegate=(id)self; controller.sourceType=UIImagePickerControllerSourceTypeCamera; [self presentViewController:controller animated:YES completion:nil]; But in iOS 8 I am getting this: Snapshotting a view that has not been rendered results in an empty snapshot. Ensure your view has … Read more

NSRange to Range

How can I convert NSRange to Range<String.Index> in Swift? I want to use the following UITextFieldDelegate method: func textField(textField: UITextField!, shouldChangeCharactersInRange range: NSRange, replacementString string: String!) -> Bool { textField.text.stringByReplacingCharactersInRange(???, withString: string) 16 Answers 16

Error Domain=NSURLErrorDomain Code=-1005 “The network connection was lost.”

I have an application which works fine on Xcode6-Beta1 and Xcode6-Beta2 with both iOS7 and iOS8. But with Xcode6-Beta3, Beta4, Beta5 I’m facing network issues with iOS8 but everything works fine on iOS7. I get the error “The network connection was lost.”. The error is as follows: Error: Error Domain=NSURLErrorDomain Code=-1005 “The network connection was … Read more