iphone-sdk-3.0

iPhone: Possible to change the color of just the prompt of the UINavigationBar?

倾然丶 夕夏残阳落幕 提交于 2021-02-08 05:56:09
问题 I'm wondering if I can change the background color of just the prompt of the UINavigationBar (e.g. to red, while the rest of the navigation bar stays black), so I can use the prompt property of the UINavigationItem to display status / error messages as a one-liner. 回答1: Nope. But you can set the prompt to an empty string, and place a red-colored label on top of it. 回答2: This is an old question, but since the introduction of appearance there is a much easier way to setting prompt color (and

Hide, show annotation on MkMapView

吃可爱长大的小学妹 提交于 2020-03-17 07:29:47
问题 How to hide annotation when zooming out the map view. I have a big number of annotation i have to hide them because if the region displayed on the map is too big you can see only the annotations. 回答1: To do this, you have to check the size of your region, and depending of it you set the views hidden or not. I tested the code bellow but, you will probably need some adjustments. - (void)mapView:(MKMapView *)mapView regionDidChangeAnimated:(BOOL)animated { NSArray *annotations = [_mapView

iPhone MKMapView : the map can’t load completely

老子叫甜甜 提交于 2020-02-07 05:29:10
问题 I don't know what's make wrong, my map can load, but the image on the map is not completely load. plx help. thz a lot. Here is the simulate map from the iPhone: (Added more example image.) http://img689.imageshack.us/img689/8476/screenshot20100309at841.jpg alt text http://e.imagehost.org/0508/Screen_shot_2010-03-09_at_8_58_12_PM.jpg Here is the code: MKCoordinateRegion theRegion; MKCoordinateSpan theSpan; theSpan.latitudeDelta = 0.005; theSpan.longitudeDelta = 0.005; theRegion.center =

How to make custom TableViewCell with initWithStyle after 3.0

孤街醉人 提交于 2020-01-23 07:52:56
问题 I am trying to have custom TableViewCell with initWithStyle, since it says initWithFrame is deprecated after 3.0. Everything worked fine with initWithFrame before. Is there any tutorials or sample code available for this? Thanks. 回答1: I have subclassed UITableViewCell then override the initWithStyle method. - (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier { if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) { self.selectionStyle

How to make custom TableViewCell with initWithStyle after 3.0

99封情书 提交于 2020-01-23 07:52:11
问题 I am trying to have custom TableViewCell with initWithStyle, since it says initWithFrame is deprecated after 3.0. Everything worked fine with initWithFrame before. Is there any tutorials or sample code available for this? Thanks. 回答1: I have subclassed UITableViewCell then override the initWithStyle method. - (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier { if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) { self.selectionStyle

MPMusicPlayerController stops sending notifications

这一生的挚爱 提交于 2020-01-23 04:03:22
问题 I have a MPMusicPlayerController playing the entire iPod library and I'm subscribed to the notifications when tracks change etc. This is all working correctly When the end of the playlist is reached, MPMusicPlayerController sends a change of state notification and stops. When I re-start the player, music begins to play again but MPMusicPlayerController no longer sends notifications when tracks change, etc. Thoughts? 回答1: Apparently, MPMusicPlayerControllerPlaybackStateDidChangeNotification is

how do I detect the iPhone orientation before rotating

爷,独闯天下 提交于 2020-01-20 17:09:48
问题 In my program I'm moving things based on rotation, but I'm not rotating the entire view. I'm Using : static UIDeviceOrientation previousOrientation = UIDeviceOrientationPortrait; - (void)applicationDidFinishLaunching:(UIApplication *)application { [window addSubview:viewController.view]; [window makeKeyAndVisible]; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(didRotate:) name:@"UIDeviceOrientationDidChangeNotification" object:nil]; } - (void) didRotate:

how do I detect the iPhone orientation before rotating

旧街凉风 提交于 2020-01-20 17:07:11
问题 In my program I'm moving things based on rotation, but I'm not rotating the entire view. I'm Using : static UIDeviceOrientation previousOrientation = UIDeviceOrientationPortrait; - (void)applicationDidFinishLaunching:(UIApplication *)application { [window addSubview:viewController.view]; [window makeKeyAndVisible]; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(didRotate:) name:@"UIDeviceOrientationDidChangeNotification" object:nil]; } - (void) didRotate:

How do I add custom pins to the iPhone MapKit?

扶醉桌前 提交于 2020-01-19 05:24:25
问题 I'm testing out the MapKit framework on the iPhone and would really much like to switch the standard pin that displays a location to an image called "location.png". How can I modify my code to allow that? Maincontroller - (void)viewDidLoad { [super viewDidLoad]; // // Set the map center // CLLocationCoordinate2D coordinate; coordinate.latitude = 49.2802; coordinate.longitude = -123.1182; mapView.region = MKCoordinateRegionMakeWithDistance(coordinate, 2000, 2000); // // Set 10 random locations

iPhone “touchesBegan” and “touchesMoved” message … do not move to centre of touch

泄露秘密 提交于 2020-01-16 16:16:31
问题 I am modifying the "MoveMe" example from the apple web site. When my controller gets the "touchesMoved" message it moves the object being moved to the centre of the touch, because (pseudocode) object.center = touch.center. How can I store the offset of the initial touch so that if I start the touch/drag to the side my finger will stay on that spot while I drag it around? 回答1: You can store target_view.frame in an instance variable when touchBegan message arrives. 回答2: Can't you store that in