将代码转换为最新的swift 3.0后,我显示此错误.
还告诉我解决方案 CGSize = CGSizeMake(0,0)
static var frameAtStartOfPan: CGRect = CGRectZero
static var startPointOfPan: CGPoint = CGPointZero
Run Code Online (Sandbox Code Playgroud)
哪个也不可用.
我正在尝试使用以下代码在UITableViewCell中以宽度方式居中UIImageView:
// self.cover_image is a UIImage variable
// cell is a UITableCellView
UIImageView* backcover_imageview = [[[UIImageView alloc] initWithImage:self.cover_image] autorelease];
[backcover_imageview sizeToFit];
//center image
//float xPos = cell.contentView.frame.size.width - (self.cover_image.size.width/2);
//TODO: need better solution
//Eyeballing attempt:
float xPos = self.cover_image.size.width - 25;
CGRect bookcover_frame = backcover_imageview.frame;
bookcover_frame.origin.x = xPos;
backcover_imageview.frame = bookcover_frame;
backcover_imageview.tag = 9000;
backcover_imageview.autoresizingMask = UIViewAutoresizingFlexibleLeftMargin | UIViewAutoresizingFlexibleRightMargin;
[cell.contentView addSubview:backcover_imageview];
Run Code Online (Sandbox Code Playgroud)
我试图将UIImageView置于UITableCellView的中心,无论iPad或iPhone设备的方向如何.有谁知道正确的方法吗?