Showing posts with label accessory. Show all posts
Showing posts with label accessory. Show all posts

Tuesday, September 21, 2010

How to Hide UITabBar

Sometimes you need to show a single stand-alone UIView without letting user change tabs. For example there is a list, where you provide an info view using a disclosure accessory button. The question is then: how to hide UITabBar:
- (void)tableView:(UITableView *)tableView accessoryButtonTappedForRowWithIndexPath:(NSIndexPath *)indexPath
{
    InfoViewController *info = [[InfoViewController alloc] init];
    info.hidesBottomBarWhenPushed = YES;
    [self.navigationController pushViewController:info animated:YES];
    [info release];
}
 Pretty simple, when you find the right location to add right line(s) of code.

Tuesday, May 25, 2010

How to Create Custom Map Annotation Button

Custom accessory button for MKPinAnnotationView right side, create inside MKMapViewDelegate protocol mapView:viewForAnnotation method:
UIButton *button = [[UIButton alloc] initWithFrame:CGRectMake(0, 0, 20, 20)];
[button setImage:[UIImage imageNamed:@"myButton.png"] forState:UIControlStateNormal]; 
view.rightCalloutAccessoryView = button;
Usually sample codes use UIButtonTypeDetailDisclosure as right button, but you can't use that unless you really show additional details. For anything else, you must use a custom button.