当用户选择照片时,我正在尝试使用 didFinishPickingMediaWithInfo 。当他们选择了照片后,我想从一个数组生成一个项目到一个 UILabel,就像这样:
-(void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info
{
NSArray *myArray = [NSArray arrayWithObjects:@"test1",@"test2",@"test3",@"test4",@"test5",@"test6", nil];
int numberOfObjects = self.yourArrayOfStrings.count;
NSInteger randomNumberInRange = arc4random() % numberOfObjects;
NSString *randomText = [myArray objectAtIndex:randomNumberInRange];
self->_label.text = randomText;
}
但我收到错误:“在'FDViewController *'类型的对象上找不到属性'yourArrayOfStrings'”:“int numberOfObjects = self.yourArrayOfStrings.count;”。
我不知道应该用什么替换 yourArrayOfStrings 。有任何想法吗?