Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/user-interface/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Iphone 循环中的超阿巴作用_Iphone_Uitabbar - Fatal编程技术网

Iphone 循环中的超阿巴作用

Iphone 循环中的超阿巴作用,iphone,uitabbar,Iphone,Uitabbar,我已经创建了一个视图加载到它的工具栏,只有7个按钮。 我想为每个按钮添加操作-因此每个按钮将执行不同的操作。所有这些按钮都将加载视图,但根据用户对按钮的选择,我将加载到视图的不同屏幕,即按钮等 这是我的循环: int i =0; for (NSString *items in array) { //Set button style [barButton setStyle:UIBarButtonItemStyleBordered];

我已经创建了一个视图加载到它的工具栏,只有7个按钮。 我想为每个按钮添加操作-因此每个按钮将执行不同的操作。所有这些按钮都将加载视图,但根据用户对按钮的选择,我将加载到视图的不同屏幕,即按钮等

这是我的循环:

int i =0;

    for (NSString *items in array)
    {
        //Set button style
        [barButton setStyle:UIBarButtonItemStyleBordered];

        //Set the button title
        [barButton setTitle:[array objectAtIndex:i]];


        [barButton setAction:@selector(tmp:)];

        //Add the bar button to the array - later will load the array to the tool bar items list.
        [itemsArray insertObject:barButton atIndex:i];

        i++;


    }

正如您所看到的,setAction现在是activate tmp method-我想从数组的NSString值的方法名称中获取它-ideas?

您可以使用
nsselector或fromstring
函数。请看这里:


如果答案是你所需要的,试着接受它。或者要求一些精确性。