tags:

views:

19

answers:

0

Can anyone explain to me why the code below does not work correctly on iOS 3.1.3? On 4.0 it works great however on earlier versions the image is not respecting the size of the frame and is displaying in its original size leaving a huge image where my navItem should be???

flipView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 30, 30)];
flipView.contentMode = UIViewContentModeScaleAspectFit;

detailFlipButton = [UIButton buttonWithType:UIButtonTypeCustom];
detailFlipButton.frame = CGRectMake(0, 0, 30, 30);  
[detailFlipButton setImage:self.myImage forState:UIControlStateNormal];
detailFlipButton.imageView.contentMode = UIViewContentModeScaleAspectFit;
[detailFlipButton addTarget:self action:@selector(flipAction) forControlEvents:UIControlEventTouchUpInside];
[flipView addSubview:detailFlipButton];

UIBarButtonItem *flipBarButton = [[UIBarButtonItem alloc] initWithCustomView:flipView];         
self.navigationItem.rightBarButtonItem = flipBarButton;
[flipBarButton release];

Basically i am trying to accomplish something similar to the navItem in the top right corner of the iPod app which flips the view when tapped.