简体   繁体   中英

integers and uiimage in uipicker view

i currently have a uipicker with two components. The first contains images and works fine, the second however requires integer values.

Is this possible since the following callback method returns a UIView type not integer? Surely there must be a way around this?

-(UIView *)pickerView

any help would greatly be appreciated, many thanks

this?

- (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;
    }'
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM