ios8

UIVisualEffectView renders differently on different devices

匆匆过客 提交于 2019-12-10 12:39:56
问题 In my ViewController.swift : var img = UIImageView(image: UIImage(named: "puddles")) img.frame = view.bounds; view.addSubview(img); var effect = UIBlurEffect(style: UIBlurEffectStyle.Light) var effectView = UIVisualEffectView(effect: effect) effectView.frame = CGRectMake(0, 0, 500, 500) view.addSubview(effectView) The image as rendered using the code above in the iPad Air , iPhone 5 , or iPhone 5S simulators: The image as rendered using the code above in the iPhone 4S , iPad 2 , or iPad

Read UIApplicationLaunchOptionsURLKey in Swift

心已入冬 提交于 2019-12-10 12:39:53
问题 Simply want to read the launch options in Swift. This is my old obj-C code which worked fine: - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { NSURL *URL = [launchOptions valueForKey:UIApplicationLaunchOptionsURLKey]; if (URL) this is what I think the Swift code should look like: func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool { if let options = launchOptions

How do I set the UISearchController's searchBar to a view that isn't the tableHeaderView or navigationItem.titleview?

倾然丶 夕夏残阳落幕 提交于 2019-12-10 12:30:38
问题 I'm trying to keep the search bar in view as the table scrolls. At the moment I'm placing it as the header in a tableview, and it works as it should, but of course the search bar scrolls off screen as you go down the table. I thought I could do this simply modifying this code sample: How do I use UISearchController in iOS 8 where the UISearchBar is in my navigation bar and has scope buttons? searchController = UISearchController(searchResultsController: nil) searchController

Programmatically place partial image over another in UIView using Swift 3

£可爱£侵袭症+ 提交于 2019-12-10 12:27:31
问题 I just started working on Swift last week and i need a suggestion if the following approach is right ways of laying partial image on top of another image. I have a UIView in which I am creating 3 images programmatically. Left arrow image, middle mobile image and right arrow image as shown below. Can I partially place arrow images 50% on the mobile image? I have tried: func setupUI(){ let mobileImage = UIImage(named: "mobile") let arrowImage = UIImage(named: "arrow") middleView = UIImageView

Manipulate app permissions on iOS 8 simulator

孤人 提交于 2019-12-10 12:06:56
问题 Same question as this one, but for iOS 8. While running xctests, how can I make sure permissions are granted/denied programmatically? Is the same TCC.db used? If so, as there are no $HOME/Library/Application Support/iPhone Simulator/8.x directories, where has it moved to? 回答1: Thanks to username tbd, the TCC.db is still in use, but is now located at $HOME/Library/Developer/CoreSimulator/Devices/$DEVICEID/data/Library/TCC/ Schema of the "access" table is the same. NSArray *paths =

iPhone 6 scaling using launch images

谁说胖子不能爱 提交于 2019-12-10 12:06:19
问题 My app scales the same on iPhone 6 and 6 plus as on the 5. I'm trying to get the app to use the extra screen space on the larger phone. I've read about using the appropriate size launch images, but it only works in the simulator, not on the device. I added a 750x1334 launch image for the iPhone 6, and the various sizes for the other devices. When I launch in the simulator, the scaling takes place as expected. When I launch on the device, the screen scales to the iPhone 4s scale instead. I

UI Local Notification - Background Reschedule

本小妞迷上赌 提交于 2019-12-10 11:57:32
问题 I'm learning to develop application for ios with swift, and I'm one doubts, already googled and i not found. I'm creating a to-do list app, and was wondering if there is a way to reschedule a notification when it appears to the user For example the user registers a task every two hours, then the notification appears to the user and reagendo the new notification Can anyone help me? Thank you 回答1: You can't do it in background if your app is suspended. But UILocalNotification supports recurrent

iAd Banner Displays With Portrait Orientation Even Though Window is Landscape

拈花ヽ惹草 提交于 2019-12-10 11:55:27
问题 I have a landscape only app that I am trying to get working on iOS8. I am trying to create an iAd banner that displays across the bottom of the landscape view. However, when the ad banner displays, it displays across the center of the view and in a portrait orientation. Here is how I set up the views: app = (AppDelegate *)[[UIApplication sharedApplication] delegate]; // Init the Ad View Controller (viewController is defined as a UIViewController) viewController = [[AdViewController alloc]

iOS 8 Self Sizing Cells - Allow Zero Height

寵の児 提交于 2019-12-10 11:54:31
问题 I am using the self sizing cell feature and it works well until I want to hide a cell completely. I moved away from heightForRowAtIndexPath for this and I setup the following: override func viewDidLoad() { self.tableView.rowHeight = UITableViewAutomaticDimension self.tableView.estimatedRowHeight = 0 } However when I have no text for a tableviewcell to render I get the following message: Warning once only: Detected a case where constraints ambiguously suggest a height of zero for a tableview

Posting JSON data to server

点点圈 提交于 2019-12-10 11:46:34
问题 I am trying to post and JSON data to server. My JSON is: { “username”:”sample”, “password” : “password-1” } The way I am sending it to server is: NSError *error; NSString *data = [NSString stringWithFormat:@"{\"username\":\"%@\",\"password\":\"%@\"}",_textFieldUserName.text,_textFieldPasssword.text]; NSData *postData = [data dataUsingEncoding:NSASCIIStringEncoding allowLossyConversion:YES]; NSData *jsonData = [NSJSONSerialization JSONObjectWithData:postData options:0 error:&error];