uiimageview

UIGesture recognition on different areas of a UIImageView

喜你入骨 提交于 2019-12-11 13:52:34
问题 I have this image: What I want to do is to add a UITapGestureRecognizer to this image (or I can split the image in the different parts it consists of and add for each part a UITapGestureRecognizer) in order to have different actions according to the leaf tapped. If I split the image in different images each for each leaf the UIImageViews will probably overlap and tapping on one will be recognized as a tap on another one. Having just one image implies knowing the points of the screen that

Finding touch location according to image in UIImageView

夙愿已清 提交于 2019-12-11 13:11:33
问题 I have an image in UIImageView and the content mode of UIImageView is set be UIViewContentModeScaleAspectFit. so how can I find the touch location according to image. Keep it in mind , my image size has large resolution like 2000 x 3000. 回答1: Try this code. I did not test it so mistakes might have been made. I hope the comments will help you enough to find the correct solution. - (CGPoint)point:(CGPoint)point onImageWithSize:(CGSize)imageSize inImageView:(UIImageView *)view contentMode:

How to detect Collision between 2 UIViews

廉价感情. 提交于 2019-12-11 13:01:31
问题 I have a UIImageView which contains my main Character, and I have made the UIImageView appear circle see below code for creating my character copter = [[UIImageView alloc] initWithFrame:CGRectMake(100, 500, 90, 90)]; [copter setContentMode:UIViewContentModeScaleAspectFit]; copter.layer.cornerRadius = roundf(copter.frame.size.width/2.0); copter.layer.masksToBounds = YES; [copter startAnimating]; [[self view] addSubview:copter]; [self setBat:copter]; I am having trouble with my collision

iPhone: Mask UIImageView of differing dimensions into square dimension

社会主义新天地 提交于 2019-12-11 12:46:13
问题 I have a bunch of UIImageViews that are in different proportions. Some of 100x101 some are 130x121. How can I mask these to 80x80 and NOT stretch the images? I basically just want to mask a square out of each one. (kind of like the Apple's Photo thumbnail view does) 回答1: Set the image view's size to 80 x 80 set the image view's contentMode property to UIViewContentModeScaleAspectFill Finally, to make round corners, use the following code, and import QuartzCore/QuartzCore.h at the beginning of

Archiving UIView Object which holds UIImageView and UIImage as a subview of it in Objective-C

亡梦爱人 提交于 2019-12-11 12:42:41
问题 How do i Archive UIVIew which has UIImagView and UIImage as subview of it. I tried to do it in this way, data= [NSKeyedArchiver archivedDataWithRootObject: viewObject]; new_ViewObject= [NSKeyedUnarchiver unarchiveObjectWithData: data]; But the program crashes saying that [UIImage encodeWithCoder:]:Unrecognized selector sent to instance. How do i solve this problem? How can i archive and unarchive this UIView Object in Objective-C? Thank U. 回答1: UIView implements the NSCoding protocol, so you

Trying to change a UIImageView each 10 seconds

情到浓时终转凉″ 提交于 2019-12-11 12:17:47
问题 Well, I have a UIImageview in one of my views. I would like to change the image every 10 seconds, but I don't have any idea of how can I make it. Any suggestion? 回答1: Create array of images first. NSArray *images = [NSArray arrayWithObjects:[UIimage imagenamed:@"image1.png"],[UIimage imagenamed:@"image2.png"],[UIimage imagenamed:@"image3.png"],[UIimage imagenamed:@"image4.png"]]]; Then set array to UIImageViews "animationImages"property imageView.animationImages = images; Set time for

Crop image in swift

家住魔仙堡 提交于 2019-12-11 10:48:05
问题 I am trying to crop image in swift. I'm trying to implement something like, user will capture a photo. Once photo is captured user will be allowed to set the crop area. I'm able to get the image from that crop area, but I want that the crop image should be resized to particular width and height. That is, if particular height or width is smaller then it should be resized. This image should be of frame of it's maximum width and height. Currently it is just adding transparency to the other area.

Using UIPickerView to display different images upon selection in UIImageView

淺唱寂寞╮ 提交于 2019-12-11 10:42:36
问题 I have a UIPickerView filled with an array of tree types. I also have an empty UIImageView below that I would like to change upon the selection of the picker view. I got a label to change with the selection but cannot get images to change. Here is what I have so far EDIT EDIT : Now working! Correct Code below #import "ViewController.h" @interface ViewController () @end @implementation ViewController - (void)viewDidLoad { [super viewDidLoad]; // Do any additional setup after loading the view,

UIImage inside a UITextField

*爱你&永不变心* 提交于 2019-12-11 10:39:00
问题 How can i place an image inside a UITextField like in iMessages or Kik ? Do i need to make a UIView with a UITextInput / UITextField and add a UIImageView as a subview? I really don't know how to approach it. 回答1: Yes, you will have to make a UIView and add imageView as its subview.You can also use alternatives given here https://www.cocoacontrols.com/search?utf8=%E2%9C%93&q=chat 回答2: You can use these controls for this : uibubbletableview bubblethingie 来源: https://stackoverflow.com/questions

How to Importing image from server and arrange it in a view

别说谁变了你拦得住时间么 提交于 2019-12-11 10:38:54
问题 I need to get array of images that have to call from server and arrange that in an order.But while executing below code i can't get it...Guidance please... - (UIView *)carousel:(iCarousel *)carousel viewForItemAtIndex:(NSUInteger)index reusingView:(UIView *)view { NSURL *url = [NSArray arrayWithObjects:[NSURL URLWithString: @"http://images.wikia.com/marvelmovies/images/5/5e/The-hulk-2003.jpg"], [NSURL URLWithString:@"http://cdn.gottabemobile.com/wp-content/uploads/2012/06/ios62.jpg"], [NSURL