Я новичок в разработке iPhone. Я пишу код для приложения Crystal Ball, в котором фоновое изображение выходит за рамки, когда я запускаю симулятор iPhone. Я стараюсь делать что-то прагматично. Ниже приводится кодиз связанного изображения в симуляторе iOS
импорт "ViewController.h"
@interface ViewController()
@end
@implementation ViewController
@synthesize predictionLabel;
@synthesize predictionArray;
- (void)viewDidLoad
{
[super viewDidLoad];
UIImage *image = [UIImage imageNamed: @"crystal_ball [email protected]"];
UIImageView *imageView =[[UIImageView alloc] initWithImage:image];
[self. view insertSubview:imageView atIndex:0];
self.predictionArray = [[NSArray alloc] initWithObjects:@"It is decideley so",
@"good things coming",
@"Good time is here",
@"Great profit",
@"stay possitive",@"Stay Foccused",@"all is well",nil];
// Do any additional setup after loading the view, typically from a nib.
}
- (void)viewDidUnload
{
[self setPredictionLabel:nil];
[self setPredictionLabel:nil];
[self setPredictionLabel:nil];
[self setPredictionLabel:nil];
[super viewDidUnload];
// Release any retained subviews of the main view.
}
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
return (interfaceOrientation != UIInterfaceOrientationPortraitUpsideDown);
}
- (IBAction)buttonPressed:(UIButton *)sender {
NSUInteger index = arc4random_uniform(self.predictionArray. count);
self.predictionLabel.text = [self.predictionArray objectAtIndex: index];
}
@end
В чем проблема? – CodaFi
Возможно, вы используете изображение с высоким разрешением (для отображения сетчатки), но вы используете неправильный iphone sim? у вас также есть crystal_ball copy @ .png в папке с изображениями? – mat
Нет, я не использовал crystal_ballcopy.png в папке с изображениями. И какой образ мне нужно использовать, чтобы исправить это. Другой момент, который я хотел бы сделать, заключается в том, что, хотя я использую Image View в раскадровке, одно и то же изображение прекрасно работает, но когда я пытаюсь сделать то же самое, что проблема возникает, – Maverick10