0

ピッカー ビューで 1 行のフォントの色を変更する必要があります。それがカラスのイメージだとしましょう。どうすればよいでしょうか。
これは私がこれまでに持っているものです。
検索しましたが、ここで答えが見つかりません。また、起動時にピッカー ビュー アプリに起動画像を表示できますか。

[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
//Load up NSArray object
_fuglar = [[NSArray alloc]initWithObjects:@"Allt árið", @"Hrafn", @"Svartbakur",@"Silfurmáfur",@"Sílamáfur",@"Frá 20.ágúst til 15.mars",@"Grágæs",@"Heiðagæs",@"Frá 1.september til 15.mars",@"Fýll",@"Dílaskarfur",@"Toppskarfur",@"Helsingi",@"Stokkönd", @"Urtönd",@"Rauðhöfðaönd",@"Duggönd",@"Skúfönd",@"Hávella",@"Toppönd",@"Hvítmáfur",@"Hettumáfur",@"Rita",@"Álka",@"Langvía",@"Stuttnefja",@"Teista",@"Lundi",@"Rjúpa", nil];
}

- (void)didReceiveMemoryWarning
{
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}

#pragma mark - UIPickerView Methods
- (NSInteger)numberOfComponentsInPickerView:(UIPickerView *)pickerView
{
return 1;
}

- (NSInteger)pickerView:(UIPickerView *)pickerView numberOfRowsInComponent:      (NSInteger)component
{
return _fuglar.count;
}

- (NSString *)pickerView:(UIPickerView *)pickerView titleForRow:(NSInteger)row forComponent:(NSInteger)component
{
return [_fuglar objectAtIndex:row];
}

- (void)pickerView:(UIPickerView *)pickerView didSelectRow:(NSInteger)row inComponent: (NSInteger)component
{
 //Create UIImage objects
UIImage * uglaImage = [UIImage imageNamed:@"ugla1.jpg"];
UIImage * ravenImage = [UIImage imageNamed:@"raven.jpg"];
UIImage * svartbakurImage = [UIImage imageNamed:@"svartbakur2.jpg"];
UIImage * silfurmafurImage = [UIImage imageNamed:@"silfurmafur.jpg"];


switch (row) {
    case 0:
        fuglarImage.image = uglaImage;
        break;
    case 1:
        fuglarImage.image = ravenImage;
        break;
    case 2:
        fuglarImage.image = svartbakurImage;
        break;
4

1 に答える 1

0

pickerView:viewForRow:forComponent:reusingView:の代わりに実装する必要がありpickerView:titleForRow:forComponent:ます。

実装は、UILabel必要な属性を含む を返す必要があります。

于 2013-05-19T02:39:54.153 に答える