小编Fod*_*ddy的帖子

PerformSegueWithIdentifier不起作用

我正在尝试使用use self.performSegueWithIdentifier来远程加载JSON文件时更改Storyboard上的视图.为此,我使用Swift类"Agent"来执行HTTP请求.当我写作时,一切都在运作

self.performSegueWithIdentifier("toView2", sender: self)
Run Code Online (Sandbox Code Playgroud)

超出"完成"变量.为什么不起作用?我想这与"发件人:自我"有关.但我不知道如何解决这个问题.我在Xcode上没有任何错误.它只是从我的服务器加载数据然后没有任何反应......

    @IBAction func goToView2(sender: AnyObject) {
    let done = { (response: NSHTTPURLResponse!, data: Agent.Data!, error: NSError!) -> Void in
        self.namesJSON = JSONValue(data!)
        self.performSegueWithIdentifier("toView2", sender: self)
    };
    Agent.post("http://api.example.com/test.php", headers: [ "Header": "Value" ],
        data: [ "test": "ok" ], done: done)
}
Run Code Online (Sandbox Code Playgroud)

agent ios segue swift

14
推荐指数
1
解决办法
7455
查看次数

如何通过Swift for iOS调用不同的故事板?

我为每个iOS设备系列创建了一个带有三个不同故事板的应用程序.现在我不知道如何在应用程序启动时选择正确的Storyboard?我正在检查屏幕高度以识别不同的设备:

func application(application: UIApplication!, didFinishLaunchingWithOptions launchOptions: NSDictionary!) -> Bool {
    // Check Device Family
    var bounds: CGRect = UIScreen.mainScreen().bounds
    var screenHeight: NSNumber = bounds.size.height
    var deviceFamily: String
    if screenHeight == 480 {
        deviceFamily = "iPhoneOriginal"
        // Load Storyboard with name: iPhone4
    } else if screenHeight == 568 {
        deviceFamily = "iPhone5Higher"
        // Load Storyboard with name: iPhone5
    } else {
        deviceFamily = "iPad"
        // Load Storyboard with name: iPad
    }

    return true
}
Run Code Online (Sandbox Code Playgroud)

有人可以在Swift中给我一个有效的解决方案吗?我只找到了ObjC的解决方案.

谢谢.

storyboard ios swift

5
推荐指数
1
解决办法
2万
查看次数

How to create a ruler / scale slider with Swift 3?

I'm trying to recreate a temperature ruler similar to the Coinbase app for an app in Swift 3. Unfortunately, I'm not sure if I follow the right approach.

In my current experiment, I used a UIScrollView element and placed / drawn lines at a certain distance (with a loop and UIBezierPath). In the next step I want to read the user input. With the current approach I have to use the X-position of the UIScrollView to convert things to read …

user-interface ios swift

5
推荐指数
1
解决办法
2401
查看次数

如何在DynamoDB(iOS)中查询StringSet值?

我正在尝试找出如何使用适用于iOS的AWS开发工具包v2在AWS DynamoDB中使用StringSet中包含的特定标签搜索某些行。

在DynamoDB的官方Amazon iOS文档中,我找不到用于执行此操作的任何内容,因此我尝试了此表达式,但它不起作用:

let queryExpression = AWSDynamoDBQueryExpression()
queryExpression.limit = 300
queryExpression.filterExpression = "tags CONTAINS :tag"
queryExpression.expressionAttributeValues = [":tag": self.searchQueryTag]

Global.appDelegate().dynamoDBObjectMapper.query(BlogPost.self, expression: queryExpression)
    .continueWithBlock({(task: AWSTask) -> AnyObject? in

    if (task.exception != nil || task.error != nil)
    {
        completion(response: 0)
    }
    else if ((task.result) != nil)
    {
        if(task.result!.count > 0)
        {
            // LIST ALL IDS…
        }
        else
        {
            completion(response: 0)
        }
    }

    return nil
})
Run Code Online (Sandbox Code Playgroud)

有人可以教我如何使用AWS iOS SDK在DynamoDB的StringSets(NSSets)中作为特定字符串查询吗?

amazon-web-services ios amazon-dynamodb

1
推荐指数
1
解决办法
2177
查看次数