Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/iphone/46.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 uipicker视图中的整数和uiimage_Iphone_Objective C_Ios_Uikit_Uipickerview - Fatal编程技术网

Iphone uipicker视图中的整数和uiimage

Iphone uipicker视图中的整数和uiimage,iphone,objective-c,ios,uikit,uipickerview,Iphone,Objective C,Ios,Uikit,Uipickerview,我目前有一个包含两个组件的uipicker。第一个包含图像,工作正常,但第二个需要整数值 由于以下回调方法返回的UIView类型不是整数,这是否可能?肯定有办法解决这个问题 -(UIView*)pickerView 非常感谢您的帮助,非常感谢这个 - (UIView *)pickerView:(UIPickerView *)pickerView viewForRow:(NSInteger)row forComponent:(NSInteger)component reusingView:(UIV

我目前有一个包含两个组件的uipicker。第一个包含图像,工作正常,但第二个需要整数值

由于以下回调方法返回的UIView类型不是整数,这是否可能?肯定有办法解决这个问题

-(UIView*)pickerView

非常感谢您的帮助,非常感谢

这个

- (UIView *)pickerView:(UIPickerView *)pickerView viewForRow:(NSInteger)row forComponent:(NSInteger)component reusingView:(UIView *)view
{   
    switch (component) {
    case 1:
    {
        UILabel *intvalue = view?(UILabel *)view:[[[UILabel alloc] initWithFrame:CGRectMake(0,0, 50, 40)] autorelease];
        intvalue.text = [NSString stringWithFormat:@"%d",value];
        intvalue.textAlignment = UITextAlignmentCenter;
        intvalue.backgroundColor = [UIColor clearColor];
        return intvalue;
        break;
    }'
}

只需返回一个UILabel显示int值我试过了,但它崩溃了,或者你的意思是实现-(UILabel*)pickerView原型?多亏了一堆adali,我意识到我添加了一个ccLabel,当然它永远不会工作:)