调用一个IBAction为我是新来的Objective-C,Xcode和所有的好东西。我是自学的。从另一个方法
我想从另一种方法调用IBAction
。
- (IBAction)strAdj:(UIStepper *)strStepper
{
// Converts stepper to integer
NSUInteger strvalue = strStepper.value;
// Changes the the text to the value of the stepper
strStat.text = [NSString stringWithFormat:@"%2d", (unsigned)strvalue];
_strMod.text = [NSString stringWithFormat:@"%2d", (unsigned)stepperAdj(strvalue)];
// Based on the value it change the strMod to a specific value
}
我只是张贴了下一个代码的一部分。这是一个简单的switch
声明。我基本上想在下面的Void中调用上面的IBAction。
-(void)pickerView:(UIPickerView *)pickerView didSelectRow:(NSInteger)row inComponent:(NSInteger)component
{
switch (row) {
case 0:
break;
// Core races never change
// defines dwarf stats
case 1:
// sets all the increases
tempCon = 2;
tempWis = 2;
tempChr = -2;
// resets all other stats
tempStr = 0;
tempDex = 0;
tempInt = 0;
// I want to call the IBAction here...
break;
这IBAction
将需要最终发生15次。上述switch
声明发生在拾取器更改时。每当步进发生时,就会发生IBAction
。
我希望我不会离我想做的事情太远。在过去的几天里,我只是一直在做这件事,而且我一直没有找到我要找的东西,或者如果我做了,我不知道该怎么做。
为什么你需要调用从选择器的委托方法步进行动? – rmaddy