uiimageview

iphone : How to rotate a rectangle image with touch events?

爱⌒轻易说出口 提交于 2019-12-25 03:53:41
问题 transform a square image or round image is easy to do... But what if a rectangle image ??? This is the image I want to transform with touch event . The circle center is (30 , 236) , if I touch any place on the screen Imageview will transform the arrow to my touch point. But the circle center still the same place . I try to transform the image use a test angle It will become like this ... How to adjust the image ? Also the code is here - (void)viewDidLoad { CGRect arrowImageRect = CGRectMake

Issue with loading and caching retina images for UIImageView animation

前提是你 提交于 2019-12-25 03:52:43
问题 What I have For my game I'm creating several animations using view.animationImages = imagesArray; [view startAnimating]; In my animation helper class I use this - (UIImage *)loadRetinaImageIfAvailable:(NSString *)path { NSString *retinaPath = [[path stringByDeletingLastPathComponent] stringByAppendingPathComponent:[NSString stringWithFormat:@"%@@2x.%@", [[path lastPathComponent] stringByDeletingPathExtension], [path pathExtension]]]; if ([UIScreen mainScreen].scale == 2.0 && [[NSFileManager

The iPhone Game Background as Video or Animated Image?

穿精又带淫゛_ 提交于 2019-12-25 03:48:07
问题 I need to create a very short background animation for the entire iPhone screen. I am trying to figure out whether I should use a video or animate a series of PNG files. Does anybody know the advantage of using video as an app background instead of the series of PNG files being animated inside UIImageView? I heard that video can be compressed to really small size and will look better that animated PNGs. Thanks in advance. 回答1: I really don't think using a video rather than a series of PNG is

Can't link connector from UIImageView declared as an IBOutlet in a class to the corresponding UIImageView on the View Controller in storyboard

女生的网名这么多〃 提交于 2019-12-25 03:43:29
问题 This question is a follow up to: Can't link connector from IBOutlet to View Controller I would now like to link another object of UIImageView called image, defined in class B to the same UIImageView on the ViewController. I wasn't able to do this using the same method. I imagine this is because, the UIImageView on the ViewController is now of custom class B, and the object image is an instance of UIImageView. I tried to cheat xcode by changing back the custom class of the UIImageView to

removeFromSuperview not working

巧了我就是萌 提交于 2019-12-25 03:28:24
问题 To my view I add imageView but after I remove it this image stay on view, how remove it ? Create: (void)handleTapHold:(UILongPressGestureRecognizer *)gestureRecognizer{ UIImageView *pinkIm = [[UIImageView alloc]initWithFrame:CGRectMake(self.roundView.frame.origin.x + 70, self.roundView.frame.origin.y - 70, 60, 60)]; [pinkIm setImage:[UIImage imageNamed:@"pink_print"]]; pinkIm.layer.cornerRadius = pinkIm.frame.size.height / 2; pinkIm.layer.borderWidth = 3.0f; pinkIm.layer.borderColor =

UIScrollView contains more views than exist when looping programmatically

主宰稳场 提交于 2019-12-25 03:12:05
问题 I'm resizing my scroll view's content size programmatically. To do this, I look through all of the views contained within it and get the highest value for the view origin plus the view height, then set my content size to that plus 10. For some reason, I have a lot of white space at the bottom of my page. I used an NSLog() to find out what object it thought was this big and found that it is an object that does not even exist. Here is my code: - (void)resize_scrollview_to_fit { CGFloat

How to change image of UIImageView that is inside a UIButton programmatically?

主宰稳场 提交于 2019-12-25 02:45:05
问题 I created a UIButton with UIImageView and UILabel by the help of this question and answer by Tim and now I want change the image of the UIImageView on the button click event. I tried [sender.imageView setImage:image] but it not working 回答1: you can: 1 - keep a reference to the UIImageView inside the UIButton on your viewController 2 - Subclass the UIButton and add the UIImageView yourself. 3 - When adding the UIImageView, add a tag into it (view.tag) and when getting the view from the sender,

Why can't I use one UIImageView on more than 1 button?

≯℡__Kan透↙ 提交于 2019-12-25 02:25:23
问题 I'm having a problem with the following code. I want to use one UIImageView on more than 1 button, it seems logical to me to only define the UIImageView once and use it as many times as necessary. If I try to attach the imgView1 to two different buttons only one of them is displayed. I can get round this by using the commented out imgView2. But it seems silly that I have to do this. Why can't I just have one UIImageView and then add it to as many views as I require? // This will not allow me

UIImageView not resizing when bounds or frame is changed?

梦想与她 提交于 2019-12-25 02:24:46
问题 So I have a custom view (its a custom textview that sits on top of keyboard); however it can resize so I would like the background image (UIImageView with UIImage inside of it) to scale with it. The following code does nothing: //size of entire custom view CGRect bFrame = self.keyboard.frame; bFrame.origin.y += heightDifference; bFrame.size.height += heightDifference; //lets set frame and bounds for the uiimageview self.keyboard.background.frame = bFrame; self.keyboard.background.bounds =

Smooth move and pinch of UIImageView

流过昼夜 提交于 2019-12-25 01:45:57
问题 I have an image view that I want to be able to move around, and pinch to stretch it. It's all working, but it's kinda jumpy when I start to do any pinch movements. The position will jump back and forth between the two fingers. - (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event { startLocation = [[touches anyObject] locationInView:mouth_handle]; if([touches count] == 2) { NSArray *twoTouches = [touches allObjects]; UITouch *first = [twoTouches objectAtIndex:0]; UITouch *second =