0

我需要在我的选择器视图中更改一行中的字体颜色,假设这是我的乌鸦图像,我该怎么做。
这就是我到目前为止所拥有的。
我已经搜索过,但在这里找不到答案。当我启动它时,我可以在我的选择器视图应用程序中有一张启动图片吗?

[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带有您需要的任何属性的 a 。

于 2013-05-19T02:39:54.153 回答