草庐IT

uiimageviews

全部标签

ios - 从 URL 加载 UIImage 时在 UITableViewCell 中设置 UIImageView 大小?

从URL加载图像到uiimage,然后将这些图像添加到uitableviewcelluiimageview,如下代码所示。我不知道图像大小,但需要在tableviewcell图像中强制它们为40x40。图像在uitableview中以不同的宽度不断加载。通读与uiimage大小/缩放相关的其他帖子,但这些解决方案对我不起作用。我认为这是因为我使用的是uitableviewcell中包含的uiimageview而不是创建我自己的uiimageview。这是-(UITableViewCell*)tableView:(UITableView*)tableViewcellForRowAtInd

IOS:旋转 uiimageview

在我的应用程序中,我有一个ImageView,它的名字是箭头,我以这种方式将它旋转180度:arrow.transform=CGAffineTransformMakeRotation(M_PI);它工作正常,但现在我希望这个ImageView返回到原来的位置;我应该设置多少值才能获得它? 最佳答案 要让它回到原来的位置,只需这样做:arrow.transform=CGAffineTransformMakeRotation(0);以度为单位,0弧度是0度,所以它应该回到原来的位置。 关于I

ios - uiimageview 上的特定形状图像

我们可以使用UIImageView在图像上设置以下形状吗?任何想法!谢谢 最佳答案 Swift3版本-带边框像其他人建议的那样,我会使用图像的mask属性。Apple提供的有关mask属性的信息:Thelayer’salphachanneldetermineshowmuchofthelayer’scontentandbackgroundshowsthrough.Fullyorpartiallyopaquepixelsallowtheunderlyingcontenttoshowthroughbutfullytransparentpi

UiImageView 上的 iPhone "Wobbly"动画

我正在尝试让图标“摇晃”。在加载我的Controller时,我创建了一个这样的计时器:[NSTimerscheduledTimerWithTimeInterval:0.2target:selfselector:@selector(shakeIphonePic)userInfo:nilrepeats:YES];这是我的摇床方法:-(void)shakeIphonePic{[UIViewanimateWithDuration:0.09delay:0options:UIViewAnimationOptionAllowUserInteractionanimations:^{self.iphon

ios - CocoaPods UIImageView+AFNetworking.h 无法识别的选择器 setImageWithURLRequest

我已经在Xcode5上安装了AFNetworking2.1.0和CocoaPods。//ViewController.h#import#import在UIImageview上调用setImageWithURLRequest应用程序失败并显示此日志:这是错误日志:2014-02-0711:55:19.984OPS[1717:60b]***Terminatingappduetouncaughtexception'NSInvalidArgumentException',reason:'-[UIImageViewsetImageWithURLRequest:placeholderImage:s

ios - 在 UIImageView 上添加渐变

我想在我的UIImageView上添加一个子层,但它不起作用。我有一组10张图像,名称从photo0到photo9并且我显示它的定时器为5秒。outletshanghaiImage是我的背景我想在这个马蒂的顶部添加一个渐变,例如:透明(顶部)到黑色(底部)。感谢您的帮助:)这是我在Swift3中的代码。这部分很好:importUIKitclassViewController:UIViewController{@IBOutletweakvarshanghaiImage:UIImageView!//beginningindexvar_curentImageIndex:Int=0//numb

iphone - 在 UIImageView 中旋转图像

是否可以在UIImageView中只旋转图像?我正在寻找有关它的信息,但我只找到了如何旋转UIImageVeiw的信息。 最佳答案 您可以使用以下代码旋转图像。请注意,这使用了CGImageRef,您可以通过从UIImage获取它CGImageRefimageRef=[selfCGImageRotatedByAngle:[imageCGImage]angle:30];获得旋转后的图像后,您可以像这样将ImageView的图像设置为新的旋转图像:UIImage*img=[UIImageimageWithCGImage:imageRef

objective-c - 创建 UIImageView

如何在代码中创建UIImageView,而不是在我的xib文件中创建它? 最佳答案 您可以单独创建一个UIImage,并从您的UIImage创建您的UIImageView。UIImage*myImage=[UIImageimageNamed:@"great_pic.png"];UIImageView*myImageView=[[UIImageViewalloc]initWithImage:myImage];然后,设置UIImageView的大小[myImageViewsetFrame:CGRectMake(0,0,100,200)]

iphone - 找不到 SDWebImage/UIImageView+WebCache.h 文件

我正在尝试在我的iPhone应用程序中使用SDWebImage。我按照分步教程将SDWebImage安装到我的Xcode项目中。当我尝试构建我的应用程序时,出现以下错误:LexicalorPreprocessorIssue'SDWebImage/UIImageView+WebCache.h'filenotfound谁能帮我解决这个问题? 最佳答案 SDWebImage的更简洁的“安装”如下:将SDWebImage文件夹从Finder拖到您的Xcode项目中在您希望使用它的任何.m文件中添加:#import"UIImageView+W

iphone - 如何在 ios 中使用 URL 和 NSString 在 UIImageView 上显示图像?

我想使用URL和NSString在UIImageView上显示图像。我无法显示图像。我的代码是:UIImageView*view_Image=[[UIImageViewalloc]initWithFrame:CGRectMake(view_Image_Pos_X,view_Image_Pos_Y,179,245)];view_Image.backgroundColor=[UIColorgreenColor];view_Image.tag=img;view_Image.userInteractionEnabled=YES;view_Image.autoresizesSubviews=YE