Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/joomla/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Iphone Can';似乎无法通过UIImage和UITableViewCell解决此问题;s内容视图_Iphone_Ios_Objective C_Uitableview_Imageview - Fatal编程技术网

Iphone Can';似乎无法通过UIImage和UITableViewCell解决此问题;s内容视图

Iphone Can';似乎无法通过UIImage和UITableViewCell解决此问题;s内容视图,iphone,ios,objective-c,uitableview,imageview,Iphone,Ios,Objective C,Uitableview,Imageview,我需要我的细胞的图像视图有一个44x44像素的区域,以便它可以点击。然而,当我尝试这样做时,我的26x26图像在未经我允许的情况下被缩放到44x44,所以现在我的26x26图像很大而且模糊。我需要将26x26图像保持在26x26,但同时将imageView帧增加到44x44。这就是我所做的,但没有奏效: //UITableViewCell subclass method - (void) layoutSubviews { [super layoutSubviews]; self

我需要我的细胞的图像视图有一个44x44像素的区域,以便它可以点击。然而,当我尝试这样做时,我的26x26图像在未经我允许的情况下被缩放到44x44,所以现在我的26x26图像很大而且模糊。我需要将26x26图像保持在26x26,但同时将imageView帧增加到44x44。这就是我所做的,但没有奏效:

//UITableViewCell subclass method

- (void) layoutSubviews {
    [super layoutSubviews];
    self.imageView.frame = CGRectMake(0, 0, 44.0, 44.0);
    self.imageView.contentMode = UIViewContentModeScaleAspectFit;
}

//TableView method    
-(void)configureCell:(UITableViewCell *)cell atIndexPath:(NSIndexPath *)indexPath {
 UIImage *originalImage = [UIImage imageNamed:@"unchecked.png"];
 CGRect screenRect = CGRectMake(0, 0, 26.0, 26.0);
 UIGraphicsBeginImageContext(screenRect.size);
 [originalImage drawInRect:screenRect];
 cell.imageView.image = UIGraphicsGetImageFromCurrentImageContext();
 UIGraphicsEndImageContext(); 
}

尝试将内容模式设置为中心:

self.imageView.contentMode = UIViewContentModeCenter;

伙计,你在用44x44holy moly强制绘制图像,你是个天才。