// 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];
我试图将UIImageVIEw置于UItableCellVIEw中心,无论iPad或iPhone设备的方向如何.有谁知道正确的方法吗?
解决方法 将backcover_imageVIEw添加到单元格的contentVIEw后,使用它来居中它:imageVIEw.center = CGPointMake(cell.contentVIEw.bounds.size.wIDth/2,cell.contentVIEw.bounds.size.height/2);@H_403_27@ 总结
以上是内存溢出为你收集整理的iphone – 无论方向如何,如何将UIImageView置于UITableViewCell中心?全部内容,希望文章能够帮你解决iphone – 无论方向如何,如何将UIImageView置于UITableViewCell中心?所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)