iphone-sdk-3.0

How can an iPhone access another non-iPhone device over wireless or Bluetooth?

女生的网名这么多〃 提交于 2019-11-26 07:22:24
问题 I\'m trying to figure out if an iPhone can connect to another non-iPhone device over wireless or Bluetooth and have seen conflicting information. Much of what I\'ve found was before version 3.0 of the SDK came out, when it certainly wasn\'t possible. Looking at Stack Overflow questions, like Can the iPhone 3.0 SDK provide full access to Bluetooth devices (headsets)? mention you can\'t connect to an arbitrary device unless if it\'s part of the \"Works for iPhone\" device. Do I need hardware

Prevent a UISearchDisplayController from hiding the navigation bar

守給你的承諾、 提交于 2019-11-26 07:18:01
问题 Whenever a user begins editing a UISearchDisplayController \'s search bar, the search controller becomes active and hides the view\'s navigation bar while presenting the search table view. Is it possible to prevent a UISearchDisplayController from hiding the navigation bar without reimplementing it? 回答1: The new UISearchController class introduced with iOS 8 has a property hidesNavigationBarDuringPresentation which you can set to false if you want to keep the navigation bar visible (by

How to detect when keyboard is shown and hidden

不打扰是莪最后的温柔 提交于 2019-11-26 06:35:20
问题 How can I detect when the keyboard is shown and hidden from my application? 回答1: In the ViewDidLoad method of your class set up to listen for messages about the keyboard: // Listen for keyboard appearances and disappearances [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardDidShow:) name:UIKeyboardDidShowNotification object:nil]; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardDidHide:) name:UIKeyboardDidHideNotification

UITextField for Phone Number

a 夏天 提交于 2019-11-26 06:16:26
问题 I was wondering how I can format the textField that I\'m using for a phone number (ie like the \"Add New Contact\" page on the iPhone. When I enter in a new mobile phone, ex. 1236890987 it formats it as (123) 689-0987.) I already have the keyboard set as the number pad. 回答1: Here is my solution.. works great! Formats the phone number in realtime. Note: This is for 10 digit phone numbers. And currently it auto formats it like (xxx) xxx-xxxx.. tweak to your hearts delight. First in your

How to intercept touches events on a MKMapView or UIWebView objects?

做~自己de王妃 提交于 2019-11-26 03:18:01
问题 I\'m not sure what I am doing wrong but I try to catch touches on a MKMapView object. I subclassed it by creating the following class : #import <UIKit/UIKit.h> #import <MapKit/MapKit.h> @interface MapViewWithTouches : MKMapView { } - (void) touchesBegan:(NSSet *)touches withEvent:(UIEvent *) event; @end And the implementation : #import \"MapViewWithTouches.h\" @implementation MapViewWithTouches - (void) touchesBegan:(NSSet *)touches withEvent:(UIEvent *) event { NSLog(@\"hello\"); //[super

Easiest way to support multiple orientations? How do I load a custom NIB when the application is in Landscape?

落花浮王杯 提交于 2019-11-26 03:04:00
问题 I have an application in which I would like to support multiple orientations. I have two .xib files that I want to use, myViewController.xib and myViewControllerLandscape.xib. myViewController.xib exists in project/Resources and myViewControllerLandscape.xib exists in the root project directory. What I want to do is use a separate NIB (myViewControllerLandscape.xib) for my rotations. I try detecting rotation in viewDidLoad l ike this: if((self.interfaceOrientation ==

Can I change the color of auto detected links on UITextView?

落花浮王杯 提交于 2019-11-26 02:52:23
问题 I had a UITextView that detects phone numbers and links, but this overrides my fontColor and change it to blueColor . Is there a way to format the color of auto detected links, or should I try a manual version of this function? 回答1: On iOS 7 you can set the tintColor of the UITextView . It affects the link color as well as the cursor line and the selected text color. iOS 7 also added a new property to UITextView called linkTextAttributes which would appear to let you fully control the link

Detecting the iPhone&#39;s Ring / Silent / Mute switch using AVAudioPlayer not working?

送分小仙女□ 提交于 2019-11-26 02:51:42
问题 I\'ve tried using these methods in an attempt to detect that the Ring/Silent switch is active or not: How to programmatically sense the iPhone mute switch? AVAudioSession category not working as documentation dictates But on my iPhone 4, the \"state\" value is always \"Speaker\" (and the length value returned by CFStringGetLength(state) is always 7). Has anyone used this method successfully? If so, on what kind of device and SDK version? I\'m calling it like so: - (BOOL)deviceIsSilenced {

How do you optionally use iPhone OS 3.0 features in a 2.0 compatible app?

别等时光非礼了梦想. 提交于 2019-11-26 02:17:32
问题 I\'d like to use some features of iPhone OS 3.0 in my 2.0 app when it runs on a 3.0 device. I don\'t want to go 3.0 all the way because there are customers who do not want to update yet. I experimented a bit with weak linking of the MapKit.framework (-weak_framework MapKit). I found it quite cumbersome, since I had to trick the compiler/linker to use the 2.0 SDK with all code except the one which uses MapKit. Has anybody more experience with this? What are you doing to make it compile/link.

How to include and use new fonts in iPhone SDK?

大憨熊 提交于 2019-11-26 00:54:13
问题 I want to use font \"MgOpen Modata\" in my iphone App. But I dont see it in the font list in Property inspector. How do I include that font so that I can use it? 回答1: Add the font files to your resource files Edit your Info.plist : Add a new entry with the key Fonts provided by application . For each of your files, add the file name to this array On the example below, I've added the font "DejaVu Sans Mono": In your application you can the use [UIFont fontWithName:@"DejaVuSansMono-Bold" size