Skip to main content

Posts

Showing posts with the label uiimageview

Add rounded corners to UIImageView

I would like to add some rounded corners to all of the UIImageViews in my project. I have already got the code working, but am having to apply it to every image; should I subclass UIImageView to add this? If so, can someone give me some pointers as to how to do this?

Preloading a large image

I have an image with the dimensions of 5534 × 3803, and size of 2.4mb. The UIView references notes that: "In iOS 3.0 and later, views are no longer restricted to this maximum size but are still limited by the amount of memory they consume." When the image loads, it lags for half a second, then slides in. The image sits in the UIImageView at 1024x704, but can be scaled up to 4x that size for the purpose of my app. Are you able to preload the image in the AppDelegate? Or is there another way of working around having such a large image? Thanks EDIT: The scaling is done via UIPinchGestureRecognizer, and scales up and done (scale x4 - x1) based on the image's center point. There is no panning of the image when zoomed in.

How to detect particular UIImageView for UITouch Events

I've added 5 UIImageView dynamically and filled it with different images, what I am trying to do is "Allow user to set position for any UIImageView", for that I used -(void) touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event { //Here I want the object of particular UIImageView on which user touched. } NSLog(@"%@",[touches anyObject]); //It returns output like below, /*<UITouch: 0x68b95e0> phase: Began tap count: 1 window: <UIWindow: 0x68875d0; frame = (0 0; 320 480); layer = <UIWindowLayer: 0x68b6470>> view: <UIImageView: 0x6a74cf0; frame = (83.7763 83.7763; 182.447 182.447); transform = [0.968912, -0.247404, 0.247404, 0.968912, 0, 0]; alpha = 0.8; opaque = NO; tag = 3; layer = <CALayer: 0x6a74980>> location in window: {161, 230} previous location in window: {161, 230} location in view: {52.7761, 105.448} previous location in view: {52.7761, 105.448}*/ //Note, in above output, it showing my UIImageView object on which I touc

How to detect particular UIImageView for UITouch Events

I've added 5 UIImageView dynamically and filled it with different images, what I am trying to do is "Allow user to set position for any UIImageView", for that I used -(void) touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event { //Here I want the object of particular UIImageView on which user touched. } NSLog(@"%@",[touches anyObject]); //It returns output like below, /*<UITouch: 0x68b95e0> phase: Began tap count: 1 window: <UIWindow: 0x68875d0; frame = (0 0; 320 480); layer = <UIWindowLayer: 0x68b6470>> view: <UIImageView: 0x6a74cf0; frame = (83.7763 83.7763; 182.447 182.447); transform = [0.968912, -0.247404, 0.247404, 0.968912, 0, 0]; alpha = 0.8; opaque = NO; tag = 3; layer = <CALayer: 0x6a74980>> location in window: {161, 230} previous location in window: {161, 230} location in view: {52.7761, 105.448} previous location in view: {52.7761, 105.448}*/ //Note, in above output, it showing my UIImageView object on which I touc

Blurry images when running my application on iPhone

So, I was creating an application for iOS with Xcode 4.2.1, I don't know why all of my icons are blurry, they are in high definition, but for some reason they looks blurry and in a bad quality. even the background images looks bad.. Please help me, what can I do about it? This is the original button image: This is how it looks on the application:

Dynamically use UIViewContentModeScaleAspectFit and UIViewContentModeScaleAspectFill

I am trying to display images on the iPhone in the same way that the Photo app does. It seems to be able to dynamically select UIViewContentModeScaleAspectFit or UIViewContentModeScaleAspectFill depending on what is appropriate for the image. Where possible I would like images to appear full screen but if not then I would like them to appear UIViewContentModeScaleAspectFit

Use a pool to spawn images

Hi every one here is my code: -(void) createNewImage { [imageView setCenter:[self randomPointSquare]]; [[self view] addSubview:imageView]; [views addObject:imageView]; [imageView release]; ix=imageView.center.x; iy=imageView.center.y; [XArray addObject:[NSNumber numberWithFloat:(240 - ix)/diviseurVitesse]]; [YArray addObject:[NSNumber numberWithFloat:(160 - iy)/diviseurVitesse]]; } -(void)moveTheImage{ for (NSUInteger i = 0; i < [views count]; i++) { imageView = [views objectAtIndex:i]; X = [[XArray objectAtIndex:i] floatValue]; Y = [[YArray objectAtIndex:i] floatValue]; imageView.center=CGPointMake(imageView.center.x + X, imageView.center.y + Y); } With this code, image are created and move to the center of the screen but after some seconds the performance decrease and come to 30fps. I would like to keep fps at 60 but I don't know how to proceed.Some people say that I can use pool but it's hard for me to use it because I don't really know how to us