2016-12-13 10 views
0

Я пытаюсь запустить мое приложение в прошивке 7+ версии, где ударило одного вопросаUIPickerView не показывает изображения в прошивке 7 + версий

У меня есть UIPickerView показ изображений правильно для версий LessThan прошивки 7, но в прошивке 7+ весь вид сборщика испорчен. Вот что им пытаются достичь

  1. У меня есть массив imageViews в Viewload
  2. Попытка отобразить же в методе ViewForRow. Пожалуйста, проверьте код ниже

    //In ViewDidLoad() 
    NSArray *box12names = [[NSArray alloc] initWithObjects:@"Black",@"Brown",@"Red",@"Orange",@"Yellow",@"Green",nil]; 
    
    self.box1_views = [[NSMutableArray alloc] initWithCapacity:10]; 
    
    // From code below , Box1_Black, Box1_Brown etc... are my png images in APP 
    
    for (NSString *str in box12names) { 
    NSString *filename = [[NSString alloc] initWithFormat:@"Box1_%@.png",str]; 
    UIImage *image = [UIImage imageNamed:filename]; 
    UIImageView *imageview = [[UIImageView alloc] initWithImage:image]; 
    
    [self.box1_views addObject:imageview]; 
    [filename release]; 
    [imageview release]; 
    
    } 
    
    [self.box1_views release]; 
    
    self.box2_views = [[NSMutableArray alloc] initWithCapacity:10]; 
    
    for (NSString *str in box12names) { 
    NSString *filename = [[NSString alloc] initWithFormat:@"Box2_%@.png",str]; 
    UIImageView *imageview = [[UIImageView alloc] initWithImage:[UIImage imageNamed:filename]]; 
    
    [self.box2_views addObject:imageview]; 
    [filename release]; 
    [imageview release]; 
    
    } 
    
    [self.box2_views release]; 
    
    [box12names release]; 
    
    
    //In PickerViewDelegate method 
    
    -(UIView *)pickerView:(UIPickerView *)pickerView 
        viewForRow:(NSInteger)row 
    forComponent:(NSInteger)component reusingView:(UIView *)view 
    
    { 
    
    NSString *arrayName = [[NSString alloc] initWithFormat:@"box%d_views", component +1]; 
    
    NSArray *array = [self valueForKey:arrayName]; 
    
    UIView *tempview = [array objectAtIndex:row]; 
    
    [arrayName release]; 
    
    return tempview; 
    
    } 
    
    
    
    //Here my picker view is displaying wierdly with iOS 7+ version whereas works good with iOS 6 
    

Пожалуйста, помогите

ответ

0

Вопрос снят -

{ 
NSString *arrayName = [[NSString alloc] initWithFormat:@"band%d_views", component +1]; 
NSArray *array = [self valueForKey:arrayName]; 
//UIView *tempview = [array objectAtIndex:row]; 
UIView *tempview=[[UIView alloc] init]; 
[tempview setBackgroundColor:[UIColor colorWithPatternImage:[[array objectAtIndex:row] image]]]; 

[arrayName release]; 
return tempview; 
} 
0

Я думаю, которого не добавить подвид из ImageView в повторное использование view.So попробовать это ниже линии в pickerView в pickerview в: viewForRow метод:

tempView.addSubview(imageView); 
+0

Но я не имею ImageView в моем методе viewForRow .. – Ashh

+0

Помещенный ImageView от viewDidiLoad к ViewforRow, –

+0

Имейте в виду, что если вам нужно ImageView в более чем 1 метод затем объявить ImageView @interfave в .m файл –

 Смежные вопросы

  • Нет связанных вопросов^_^