xcode6

Insert a UISearchBar in IOS 8, Xcode 6 [closed]

我们两清 提交于 2019-12-13 10:14:14
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 4 years ago . What is the best most efficient way to implement a UISearchBar ? I check all over the internet, and all the tutorials are for the ios 7 version, and a lot of the methods are deprecated in ios 8 . Can someone please provide a library, or a sample of how to implement a searchBar in xcode for ios 8 ? 回答1: I had to

Swift: How to get row number of a button in each table row?

安稳与你 提交于 2019-12-13 09:54:29
问题 Ive got a table. each table has its own custom button. when its pressed the following funtion runs @IBAction func select(sender: UIButton) { anobject.itsproperty[the row?] = true } how do I access which row the button was pressed from? so i can use that to access an array. 回答1: In cellForRowAtIndexPath assign the row index to the tag property of the button. cell.button.tag = indexPath.row then get the tag to distinguish the rows @IBAction func select(sender: UIButton) { if sender.tag == 0 { /

create a class using NSCoding

痴心易碎 提交于 2019-12-13 08:38:02
问题 in my first project I was creating a class using the following code: import Foundation class Rate { var currency: String! var sellRate: String! var buyRate: String! init (data: NSDictionary) { self.currency = getStringFromJSON(data, key:"CurrencyName") self.sellRate = getStringFromJSON(data, key:"SellRate") self.buyRate = getStringFromJSON(data, key:"BuyRate") } func getStringFromJSON(data: NSDictionary, key: String) -> String { if let info = data[key] as? String { return info } return "" } }

Flappy Bird Coding Error in Swift

試著忘記壹切 提交于 2019-12-13 08:05:03
问题 I've encountered a coding error for my flappy bird project, in Xcode 6.1. The code is to allow rotation of the bird, and it reads: bird.zRotation = self.acotarMinMax(-1, max: 0.3, valor: bird.physicsBody?.velocity.dy * (bird.physicsBody?.velocity.dy < 0 ? 0.003 : 0.001)) the error occurs under dy , it reads: value of optional type 'CGFloat?' not unwrapped; did you mean to use '!' or '?'? How can I correct the error, or is there another way to generate rotation? I am a total beginner of Swift,

how do conditional segue in swift

℡╲_俬逩灬. 提交于 2019-12-13 07:20:10
问题 I need to have a conditional Segue. The possible options are: If link have a children link -> I should only reload the UICollectionView. If the link do not have a children link -> Go to other windows. This is my code. override func viewDidLoad() { super.viewDidLoad() self.loaddata(self.url) } func loaddata(url: String){ var loaded: Bool = false api.remoteUrl = url + self.end_url println(api.remoteUrl) api.getData({data, error -> Void in println("entro aqui") if (data != nil){ println(data) //

Why is my Toolbar getting chopped off in compact size?

强颜欢笑 提交于 2019-12-13 05:39:09
问题 As can be seen below, my toolbar gets chopped off in the compact size: My UI consists of a ToolBar and a WebView. The constraints I tried don't work, although I did get them to turn blue. As you can see, my toolbar is pinned to the top, the left side, and the right side (I also set a constant height). How can I get my toolbar to display correctly in the compact size. Thanks. Edit1: Edit2: Here is what I did to get things to display correctly: I had to drag the edges of the WebView all the way

Storyboard UI Elements not displaying in editor

自闭症网瘾萝莉.ら 提交于 2019-12-13 05:25:07
问题 I've started building a mobile app in Xcode on the storyboard, and 2 days ago, I had all of the elements in place perfectly, but now when I open Xcode and look at the storyboard, the elements don't display and the objects in the document outline are all grayed out. I can still deploy the app to a phone or the simulator and see the elements just fine, so it doesn't seem to be an issue with the placement of the elements, but just an issue with the editor itself. Xcode Storyboard http://f.cl.ly

Core Location with Xcode 6 simulator

狂风中的少年 提交于 2019-12-13 05:15:40
问题 Core Location is not calling didUpdateLocations . I have 2 classes involved LocationManager and a View Controller. Plist is set for requestAlwaysAuthorization . Location is simulated in debug. Can anyone help me spot the error? LocationManager.h @interface LPLocationManager : NSObject <CLLocationManagerDelegate> +(LPLocationManager*)sharedManager; @property (strong, atomic) CLLocationManager *locationManager; @property (nonatomic, retain) CLLocation *location; @end LocationManager.m +

Autolayout & Alignment Constraints

萝らか妹 提交于 2019-12-13 05:14:57
问题 I want to make similar ui for all iPhones & i am currently using auto layout for that, but i do not know how to create this `UI` using `NSLayoutConstraint`? This UI works fine in small screen but i want same ui for bigger iPhone as well(keep certain amount of space between buttons). how can i add constraint in this to get same ui as iPhone 4s. i took UIButton & below titles are UILabel . Some one help me out here. Screenshots. 回答1: Personally I find that trying to make sense of Auto Layout

IPhone6/6plus landscape status bar hidden

霸气de小男生 提交于 2019-12-13 04:55:00
问题 This is an extension of this thread regarding displaying status bar for iOS8. Unfortunately, I needed to enable my apps to display the status bar on landscape orientation regardless of fixed or rotated. With my answer on this thread, the behaviour on the iPhone6 Simulator (not sure on actual device for now) the status bar doesn't get displayed. Yet when the application is resumed from other application or home screen it gets displayed. Is this normal? 回答1: No that is not normal, however you