如何在加载下一个视图之前执行UIButton操作 [英] How to perform UIButton action before loading next view

查看:58
本文介绍了如何在加载下一个视图之前执行UIButton操作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个视图,用户在其中输入3个字符串字段.在按钮上按下,字段将存储在数组中.该按钮还可以更改视图.

I have a view where a user enters 3 sting fields. On the button press the fields are stored in an array. The button also changes the view.

我遇到的问题是,当我从另一个视图的数组中获取字符串时.返回的值是已输入的先前值.

The problem im having is when I get the strings from the array in the other view. The values that are being returned are the pervious values that have been entered.

我添加了一些行来记录正在执行的操作以及从数组中执行的操作.从日志中,我可以看到在设置数组之前已调用了该数组.

I have added some lines to log what is going in and what is come out of the arrays. From the log I can see that the array is being called before it is set.

在更改视图之前,如何获取按钮以运行其操作?

How to I get the button to run its action before it changes the view?

这是我的日志:

2012-09-27 14:56:49.530 BeerDivider[1585:907] GetArray:(null)
2012-09-27 14:56:49.543 BeerDivider[1585:907] SetArray:(
    3,
    will,
    Harry
)

这是我的代码. http://pastebin.com/BX5gqp17

推荐答案

- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    if ([segue.identifier isEqualToString:@"yourSegue"]) {
       //do what you need
    }
}

这篇关于如何在加载下一个视图之前执行UIButton操作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆