Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/iphone/35.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

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/svn/5.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
如何防止iOS调整xib的大小_Ios_Iphone_Xcode_Uiview_Uiimage - Fatal编程技术网

如何防止iOS调整xib的大小

如何防止iOS调整xib的大小,ios,iphone,xcode,uiview,uiimage,Ios,Iphone,Xcode,Uiview,Uiimage,我有一个仅用于创建UIImage的xib。换句话说,首先我得到了xib,如中所示 UIView *view =[[UINib nibWithNibName:@"MyXib" bundle:nil] instantiateWithOwner:self options:nil].firstObject; //...add content to xib 然后从xib创建一个UIImage,调用 UIImage *image = [self imageWithView:view]; 方法 - (UI

我有一个仅用于创建UIImage的xib。换句话说,首先我得到了xib,如中所示

UIView *view =[[UINib nibWithNibName:@"MyXib" bundle:nil] instantiateWithOwner:self options:nil].firstObject;
//...add content to xib
然后从xib创建一个UIImage,调用

UIImage *image = [self imageWithView:view];
方法

- (UIImage *) imageWithView:(UIView *)view
{
    UIGraphicsBeginImageContextWithOptions(view.bounds.size, view.opaque, 0.0);
    [view.layer renderInContext:UIGraphicsGetCurrentContext()];

    UIImage * img = UIGraphicsGetImageFromCurrentImageContext();

    UIGraphicsEndImageContext();

    return img;
} 
问题是,我的xib尺寸为600 x 700(自由形式)。但不管出于什么原因,iPhone/iOS正在生成一个与我的iPhone差不多大的图像。但我希望我的图像保持预设的大小600乘700。我该怎么做

现在一切正常:除了生成的图像的大小似乎是我的iPhone S5的尺寸之外