UI ピッカーでまた行き詰まりました。UI ピッカーについてはまだ学習中なので、ここで何か根本的に間違ったことをしたかどうかはわかりません。
行 UIPicker から画像を表示しようとしています。
エラー:
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSCFConstantString _isResizable]: unrecognized selector sent to instance 0x70fc'
*** First throw call stack:
コードは次のとおりです。
#import "Imagepick.h"
@interface Imagepick ()
@end
@implementation Imagepick
@synthesize select;
@synthesize imageview;
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
if (self) {
// Custom initialization
}
return self;
}
- (void)viewDidLoad
{
////arrays & objects
arrStatus = [[NSArray alloc] initWithObjects:@"pic1",@"pic2",nil];
}
-(NSInteger)numberOfComponentsInPickerView:(UIPickerView *)pickerView
{
//One column
return 1;
}
-(NSInteger)pickerView:(UIPickerView *)pickerView numberOfRowsInComponent: (NSInteger)component
{
return arrStatus.count;
}
-(NSString *)pickerView:(UIPickerView *)pickerView titleForRow:(NSInteger)row forComponent:(NSInteger)component
{
return [arrStatus objectAtIndex:row];
}
- (void)pickerView:(UIPickerView *)pickerView didSelectRow:(NSInteger)row inComponent:(NSInteger)component
{
[imageview setImage:[arrStatus objectAtIndex:row]]; UIImage *pic1 = [[UIImage alloc] initWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"appstorelogo" ofType:@"png"]];
[imageview setImage:[arrStatus objectAtIndex:row]]; UIImage *pic2 = [[UIImage alloc] initWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"applogo" ofType:@"png"]];
}
- (void)viewDidUnload
{
[self setImageview:nil];
[self select:nil];
[super viewDidUnload];
// Release any retained subviews of the main view.
}
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
return (interfaceOrientation == UIInterfaceOrientationPortrait);
}
@end
*pic1
関連する場合、 &の未使用変数警告pic2
?