调整 UIImageView 数组中单个图像的大小
在我的 iPhone 应用程序中,我需要调整数组中一些 UIImageView
类型的图像的大小。我没有使用 Interface Builder 来完成这项任务。
我收到此错误:
需要左值作为左运算符赋值
使用以下代码
CGSize newsize;
for (int i = 0; i<5; i++)
{
// ball[] is of type UIImageView *
ball[i].center = CGPointMake(ball[i].center.x-5,ball[i].center.y);
if (ball[i].center.x <= 36)
{
while(ball[i].frame.size.width>0 && ball[i].frame.size.height>0)
{
newsize.height =val2--;
newsize.width =val2--;
ball[i].frame.size = newsize; // This line gives the error
}
}
}
:如果这不是正确的方法,您能告诉我应该如何调整数组中图像的大小吗?
In my iPhone app, I need to resize some images of type UIImageView
which I have in an array. I didn't use Interface Builder for this task.
I'm getting this error:
Lvalue required as left operator assgnment
using the following code:
CGSize newsize;
for (int i = 0; i<5; i++)
{
// ball[] is of type UIImageView *
ball[i].center = CGPointMake(ball[i].center.x-5,ball[i].center.y);
if (ball[i].center.x <= 36)
{
while(ball[i].frame.size.width>0 && ball[i].frame.size.height>0)
{
newsize.height =val2--;
newsize.width =val2--;
ball[i].frame.size = newsize; // This line gives the error
}
}
}
Can you tell me how should I resize my images in the array, if this is not the correct method?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您的意思是,您想要裁剪图像?
要调整图像大小,请尝试以下代码:
You mean, you want to crop the images?
To resize the images, try this code: