我正在处理应用程序的图像查看部分,我正在寻找一种调整图像大小或使其适合屏幕的方法。我的设置目前看起来像这样。
photos = [[NSMutableArray alloc]init];
Photo *pic = [[Photo alloc]init];
[pic setName:@"Picture"];
[pic setFilename:@"Pic.jpeg"];
[pic setNotes:@"Description"];
[photos addObject:pic];
pic = [[Photo alloc]init];
[pic setName:@"Picture2"];
[pic setFilename:@"pic2.jpeg"];
[pic setNotes:@"Description2"];
[photos addObject:pic];
pic = [[Photo alloc]init];
[pic setName:@"Picture3"];
[pic setFilename:@"Pic3.jpeg"];
[pic setNotes:@"Description3"];
[photos addObject:pic];
pic = [[Photo alloc]init];
[pic setName:@"Picture4"];
[pic setFilename:@"Pic4.jpeg"];
[pic setNotes:@"Description4"];
[photos addObject:pic];
这是我为segue方法做的准备
- (void) prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
{
if ([segue.identifier isEqualToString:@"ShowPhoto"])
{
DisplayViewController *dvc = [segue destinationViewController];
NSIndexPath *path = [self.tableView indexPathForSelectedRow];
Photo *c = [photos objectAtIndex:path.row];
[dvc setCurrentPhoto:c];
}
}
应该添加什么代码以使图像适合屏幕?