我设法得出了我所希望的以下内容,这显然不是最佳方式,也不是最清洁的方法,而是因为没有一位来自斯克拉奥弗洛的人提出任何更好的建议,我认为我对此作了更好的回答。
I subclassed the first 3 UITableViewCells and set a frame size to take into account the size of my image.
- (void)setFrame:(CGRect)frame {
float cellWidth = (frame.size.width - 345);
frame.size.width = cellWidth;
[super setFrame:frame];
}
随后,我用可调的电文对Load 我在表格中用第一个固定单元制作并定位UIImageView,作为IBOutlet(“第一Cell”)。 然后,我确定“马什克”的自动恢复,从而打破了轮换,最后添加“UIImage”的意见。
//Create and position the image view
UIImageView *imageView = [[UIImageView alloc] initWithFrame:CGRectMake((firstCell.frame.size.width), (firstCell.frame.origin.y + 70), 300, 137)];
// Add border and round corners of image view to make style look a little like tableviewcells
[imageView.layer setBorderColor:[UIColor colorWithWhite:0 alpha:0.5].CGColor];
[imageView.layer setBorderWidth:2.0];
[imageView.layer setCornerRadius:5.0];
[imageView setClipsToBounds:YES];
//Set the image in the image view
UIImage *image = [UIImage imageNamed:@"defaultPicture.png"];
imageView.image = image;
//Set resizing of image view for when view is rotated
imageView.contentMode = UIViewContentModeRedraw;
imageView.autoresizingMask = UIViewContentModeScaleAspectFit;
//Add tap gesture for imageview to initiate taking picture.
imageView.userInteractionEnabled = YES;
UITapGestureRecognizer *imageViewTap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(takePicture:)];
[imageView addGestureRecognizer:imageViewTap];
//Add image view to view
[self.view addSubview:imageView];
这还没有经过充分测试,而且一毫肯定不会得到很大的执行,而是它的一个起点。 如果你知道有更好的办法,请作出答复。
注:上述代码是供我阅读的iPad的,但从I.M.的测试中抽取。