I am trying to add a small icon in the center of the iPhone screen. Below is the code that I think should work, but it does not center it. The position relative to the width is fine, but the height is off, about 100 pixels off?
UIImage *pinMarker = [UIImage imageNamed:@"red_pen_marker.png"]; UIImageView *pinMarkerView = [[UIImageView alloc] initWithImage:pinMarker]; pinMarkerView.frame = CGRectMake(self.view.frame.size.width/2 - 9, self.view.frame.size.height/2 - 36, 18, 36); [self.view addSubview:pinMarkerView];
Any suggestions? Perhaps placing it according to the entire size of the application window, rather than this kind of screen?
source share