27/08/10
iPhone icon rounded corner exact radius
This might be usefull for all those designers who want to create great fancy application icons.
The exact radius for the icon rounded corners is:
- iPhone OS 3.x(57×57) is 9 pixels
- iPhone OS 4.0(114×114) I guess it’s 18 pixels but I’m not sure of that
The exact radius for the Artwork(512×512) is 80 pixels.
25/08/10
Zooming an image using UIScrollView
To add the zooming in the scrolling part you can do this by following these steps:
1. Make the MyViewController a UIScrollViewDelegate. Do this by adding
2. Create a UIImageView instance variable in the @interface of MyViewController. We will need this to specify it to the Delegate which object is to be zoomed. Add the @property and @synthesize for this image in relevant places. I used scroll2ImageView as the name of the instance.
3. In the viewDidLoad Method in myViewController.m class replace the code for setting up scrollView2 with this code.
[scrollView2 setBackgroundColor:[UIColor blackColor]];
[scrollView2 setCanCancelContentTouches:NO];
scrollView2.clipsToBounds = YES; // default is NO, we want to restrict drawing within our scrollview
scrollView2.indicatorStyle = UIScrollViewIndicatorStyleWhite;
scroll2ImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"image0.jpg"]];
[scrollView2 addSubview:scroll2ImageView];
[scrollView2 setContentSize:CGSizeMake(scroll2ImageView.frame.size.width, scroll2ImageView.frame.size.height)];
scrollView2.minimumZoomScale = 1;
scrollView2.maximumZoomScale = 3;
scrollView2.delegate = self;
[scrollView2 setScrollEnabled:YES];
We made three changes here. First we replaced the local instance of imageView with the class instance scroll2ImageView. We will need this in the next step. Second we added min/max zoom scale for the image. Third we assigned the scrollView2 delegate to self.
4. Last thing we need to do is tell the delegate wat all to zoom when it detects a zoom in/out pinch. We add the following method for this.
-(UIView *) viewForZoomingInScrollView:(UIScrollView *)scrollView {
return scroll2ImageView;
}