Iphone 循环中的超阿巴作用
我已经创建了一个视图加载到它的工具栏,只有7个按钮。 我想为每个按钮添加操作-因此每个按钮将执行不同的操作。所有这些按钮都将加载视图,但根据用户对按钮的选择,我将加载到视图的不同屏幕,即按钮等 这是我的循环:Iphone 循环中的超阿巴作用,iphone,uitabbar,Iphone,Uitabbar,我已经创建了一个视图加载到它的工具栏,只有7个按钮。 我想为每个按钮添加操作-因此每个按钮将执行不同的操作。所有这些按钮都将加载视图,但根据用户对按钮的选择,我将加载到视图的不同屏幕,即按钮等 这是我的循环: int i =0; for (NSString *items in array) { //Set button style [barButton setStyle:UIBarButtonItemStyleBordered];
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
函数。请看这里:
如果答案是你所需要的,试着接受它。或者要求一些精确性。