xcode6

UIToolbar not positioned at the bottom on device but appears ok in storyboard

冷暖自知 提交于 2020-01-07 07:59:14
问题 I'm testing the new universal storyboard in XCode 6. I basically created a view with a toolbar positioned at the bottom. When I run that basic example in the iPad the toolbar is not at the bottom And here is in the storyboard How can I place the UIToolbar at the bottom and using all the available width for all different screens? 回答1: Use Autolayout. Set the left margin, right margin and bottom space constraints on the toolbar to make it dock at the bottom. Optionally, add a height constraint

Selected button in cell is showing up on reuse cells - also using sender.tag for button distinction

拟墨画扇 提交于 2020-01-07 06:57:11
问题 I have a bunch of rows in a table and each row consists of 6 UIButtons (they are checkbox images). I started with just trying to get one button to work before linking all of them and that worked somewhat. The code would update the image to a checked box if I clicked on it and if I scrolled down and back up the first cell first box would be the only one checked. If I repeatedly scroll up and down though, it will randomly unselect that first cell first box. Here is my ViewController code: // //

unexpectedly found nil while unwrapping an Optional value reading JSON

耗尽温柔 提交于 2020-01-07 05:09:06
问题 people, I can not understand why, but this problem (unexpectedly found nil while unwrapping an Optional value) happens in this line: var dict: NSDictionary = NSJSONSerialization.JSONObjectWithData(data, options: NSJSONReadingOptions.MutableContainers, error: &error) as NSDictionary see the code: import Foundation class ProdutoService { // return a produtos Array class func getProdutos() -> Array<Produto> { var produtos: Array<Produto> = [] for (var i = 0; i < 10; i++) { var p = Produto() p

UISplitViewController doesn't work on iPhone(5 nor 6)

家住魔仙堡 提交于 2020-01-06 18:06:30
问题 On iPad, I have perfectly working UISplitViewController. I can hide and show its primaryViewController, and splitViewController:willChangeToDisplayMode: is called in appropriate way. But on iPhone, something is wrong. I can show primaryViewController, but cannot hide it, because the primaryViewController appears in full screen size. It's so full that I can't touch the secondary view, in that way I can hide the primaryViewController on iPad. splitViewController:willChangeToDisplayMode: is not

Swift calculate value of UITextFields and return value

ぐ巨炮叔叔 提交于 2020-01-06 17:59:50
问题 Using swift and Xcode 6, I'm trying to return a value calculated based on content of few UITextFields. I have declared variables var Number1 = Field1.text.toInt() var Number2 = Field2.text.toInt() var Duration = Number1*Number2 Mylabel.text = String ("\(Duration)") The idea is to capture duration from few UI Fields and based on calculation of those values assign that to a variable as well as display it on a label. In line: var Duration = Number1*Number2 Challenge is that I have is that when

Switching View Controller After Login..Best Practise

泪湿孤枕 提交于 2020-01-06 12:47:35
问题 I've successfully set up my app flow logic and everything seems to be working fine except the login. I would like to keep the users logged in so when the app is reopened the profile screen is the first to show. Right now I have code.. override func viewDidAppear(animated: Bool) { var currentUser = PFUser.currentUser() println(currentUser.objectId as String) if currentUser != nil { self.performSegueWithIdentifier("loginsuccess", sender: nil) } else { // Show the signup or login screen } } It

Xcode 6: How to solve Precompile prefix Header error

生来就可爱ヽ(ⅴ<●) 提交于 2020-01-06 02:30:44
问题 I just moved an app i've been working on from Xcode 5, onto another computer running Xcode 6, (working fine on Xcode 5) I now get the following error I assume this was an issue with a missing .pch file, when I look into this dir i found the file but its called TMU-Prefix.pch instead of TMU_4.0-Prefix.pch I figured my prefix header must be set incorrectly so I went in to build settings to change that and to my surprise my build settings is looking for the right file This file which does indeed

Converting Date Components (Integer) to String

瘦欲@ 提交于 2020-01-05 22:46:13
问题 My code takes an NSDate and reads year, month, and day, then strings them together as a single integer. I next want to convert this Int to a String, so that it can be inserted into a URL String, but without success: let calendarUnits: NSCalendarUnit = .CalendarUnitDay | .CalendarUnitMonth | .CalendarUnitYear let components = NSCalendar.currentCalendar().components(calendarUnits, fromDate: dateToBeExamined) var dateInt = components.year dateInt += components.day dateInt += components.month var

AFNetworking code giving me Memory Leaks

丶灬走出姿态 提交于 2020-01-05 17:51:11
问题 @implementation GetData static NSString *string = @"https://afternoon-springs-7986.herokuapp.com/"; static NSString *baseStr = @"https://afternoon-springs-7986.herokuapp.com/updateInformation"; -(void) postEventInfo: (NSDictionary *) eventInfoObject { NSURL *url = [NSURL URLWithString:string]; // 6.5% // NSURL *baseURL = [NSURL URLWithString:@"http://localhost:5000/"]; UIWindow *window = [[UIApplication sharedApplication] keyWindow]; UIView *topView = window.rootViewController.view; self

AFNetworking code giving me Memory Leaks

梦想与她 提交于 2020-01-05 17:49:19
问题 @implementation GetData static NSString *string = @"https://afternoon-springs-7986.herokuapp.com/"; static NSString *baseStr = @"https://afternoon-springs-7986.herokuapp.com/updateInformation"; -(void) postEventInfo: (NSDictionary *) eventInfoObject { NSURL *url = [NSURL URLWithString:string]; // 6.5% // NSURL *baseURL = [NSURL URLWithString:@"http://localhost:5000/"]; UIWindow *window = [[UIApplication sharedApplication] keyWindow]; UIView *topView = window.rootViewController.view; self