uiimageview

How to crop a UIImageView to a custom shape

北战南征 提交于 2019-12-10 23:35:35
问题 Is it possible for a user to draw a dotted line (in a circle) around the bit of the UIImageView they wish to crop to, and then for the UIImageView to resize to those points? It's a bit like the lasso/marquee effect in Photoshop: 回答1: Update: Since iOS 8.x, UIImageView provides a maskView property. Just prepare an image with some opaque pixels, create another image view with that mask image, and set this mask image view as the maskView. The opaque pixels in the mask image will be the ones

How to set image position programaticall in objective c?

爱⌒轻易说出口 提交于 2019-12-10 23:30:38
问题 I want to move image to another x,y coordinates after 3 seconds I try this but I got an error like this: 2012-01-17 14:01:11.417 YapiKrediDemo[2147:207] -[Sozlesme moveImage]: unrecognized selector sent to instance 0x6e07540 My code is: - (void)viewDidLoad { [super viewDidLoad]; // Do any additional setup after loading the view from its nib. image1=[[UIImageView alloc] initWithImage:[UIImage imageNamed:@"GirisButton.png"]]; [self.view addSubview:image1]; [NSTimer

iOS: issues with UIGestureRecognisers vs Subviews

送分小仙女□ 提交于 2019-12-10 22:34:58
问题 I have written following code to attach gesture recogniser to multiple imageviews. [imageview1 setUserInteractionEnabled:YES]; [imageview1 setMultipleTouchEnabled:YES]; [imageview2 setUserInteractionEnabled:YES]; [imageview2 setMultipleTouchEnabled:YES]; [imageview3 setUserInteractionEnabled:YES]; [imageview3 setMultipleTouchEnabled:YES]; [imageview4 setUserInteractionEnabled:YES]; [imageview4 setMultipleTouchEnabled:YES]; [imageview5 setUserInteractionEnabled:YES]; [imageview5

UIImageView subclass needs to handle resize

佐手、 提交于 2019-12-10 20:20:22
问题 I am creating a UIImageView subclass to display an audio waveform. The approach is to load the file, do math, save a PNG file and then self.image = thePNG . The nice part about this is that on a resize or repaint the UIImageView will stretch the PNG and stretch quickly. Now if the image is expanded too much then I need to recalculate the waveform to avoid visible pixelation. Since we know that UIImageView does not call drawRect, is there a method that is called during resize so that I can

stretchableImageWithLeftCapWidth:topCapHeight doesn't work in initWithCoder: of UIImageView subclass

本秂侑毒 提交于 2019-12-10 18:04:51
问题 I have a UIImageView subclass called ShadowView, which displays a shadow that can be used under anything. ShadowViews are to be loaded from a nib. In initWithCoder:, I have the following code: - (id)initWithCoder:(NSCoder *)decoder { self = [super initWithCoder:decoder]; if (self != nil) { UIImage *shadowImage = [[UIImage imageNamed:@"drop_shadow_4_pix.png"] stretchableImageWithLeftCapWidth:4 topCapHeight:4]; [self setContentMode:UIViewContentModeScaleToFill]; [self setImage:shadowImage]; }

AutoLayout: UIImageView and Aspect Fit content mode

ぐ巨炮叔叔 提交于 2019-12-10 18:00:53
问题 I'm trying to place an UIImageView in the parent view's center. Image must keep its original aspect ratio and also it shouldn't exceed parent's bounds. So landscape images should be limited by parent's width and portrait images should occupy as much vertical space as needed keeping original ratio. Sounds like quite a simple task for AutoLayout, right? Here's my setup for UIImageView : center vertically in parent center horizontally in parent imageView.width <= superview.width imageView.height

Swift display image UIImageview

非 Y 不嫁゛ 提交于 2019-12-10 16:52:07
问题 How can I display image inside UIImageview? Then change images according to pressed button. I am very new please go easy. 回答1: To do this, first make sure you have the image available in the viewcontroller (by creating an association between the image on your storyboard, and in your viewcontroller). Let's pretend it's called imageView. Programmatically, you can say: imageView.image = UIImage(named: ("nameofasset")) What I actually ended up doing is creating a static function responsible for

iOS: How to stop a background thread from updating UI in the main thread?

二次信任 提交于 2019-12-10 16:29:21
问题 I implement a UITableView of UIImageView cells, each of which periodically refreshes itself every 5 seconds via NSTimer. Each image is loaded from a server in the background thread, and from that background thread I also update the UI, displaying the new image, by calling performSelectorOnMainThread . So far so good. Currently I face a problem when I don't wait until an image is loaded at a current cell and I scroll down quickly to a new cell. That new cell, however, displays an image of a

How to load an image from Parse into a UIImageView (iOS)

跟風遠走 提交于 2019-12-10 16:04:02
问题 I might be asking something really easy, but I can't manage to find a tutorial or example that would help me. I have learned how to retrieve string data from Parse and now I am trying to retrieve an image thinking it would be easier.. but I can't figure it out. I am trying to load 1 image (that I'll be changing every day) in the UIImageView , retrieving the image from my data browser in Parse.com. Could somebody help please? Here is what I've done: - (void)viewDidLoad { [super viewDidLoad];

UIImageView image distorts when big image is placed

可紊 提交于 2019-12-10 16:00:01
问题 While trying to set a big image in UIImageView the resolution of the image distorts. Is there any way to keep the image in same resolution while fitting it in a smaller view? 回答1: try setting imageview content mode to aspectfit. imageView.contentMode = UIViewContentModeScaleAspectFit; 回答2: UIViewContentModeScaleToFill Scales the content to fit the size of itself by changing the aspect ratio of the content if necessary. Available in iOS 2.0 and later. Declared in UIView.h.