UITabBar循环中的动作

时间:2011-10-02 20:39:15

标签: iphone uitabbar

我创建了一个加载到工具栏的视图,只有很少的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现在激活tmp方法 - 我想从数组的NSString值的方法名称中获取它 - 想法?