cocoa-touch

Bounds and Frame size in viewDidLoad

主宰稳场 提交于 2020-01-04 06:03:30
问题 I push a view controller ( mainVC ) and add some subviews to it. Most of these views are built on-demand, as the user takes some action. When I build each view, I refer to mainVC.view.bounds to size the view. The ones that are built on demand size just fine, but the first one (which I add in viewDidLoad ) does not seem to account for either the hidden navigation bar or the unhidden toolbar - I'm not sure which. Other questions seem to assure me that viewDidLoad is the correct place to refer

What's the maximum number of bluetooth connections on the iPhone?

与世无争的帅哥 提交于 2020-01-04 05:30:45
问题 If you have any insight on this, it would also be nice to know whether there's a big latency between connections. 回答1: The Bluetooth protocol specifies that connections are point-to-point (hence the term "pairing"), but different profiles can be used concurrently with different stations. Each profile only supports one connection at a time. You can have a stereo headset connection with your car and a data connection with your laptop at the same time, but not multiple data connections.

How to Key-Value-Observe the rotation of a CALayer?

感情迁移 提交于 2020-01-04 05:26:14
问题 I can access the value like this: NSNumber* rotationZ = [myLayer valueForKeyPath:@"transform.rotation.z"]; But for some reason, if I try to KV-observe that key path, I get a compiler error. First, this is how I try to do it: [myLayer addObserver:self forKeyPath:@"transform.rotation.z" options:0 context:nil]; The compiler tells me: *** Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[ addObserver: forKeyPath:@"rotation.z" options:0x0 context:0x528890] was sent to an

App stops receiving data from socket when UI scroll

僤鯓⒐⒋嵵緔 提交于 2020-01-04 04:34:47
问题 I have an iPad app that receives data using UDP sockets. And it has a UIWebView to browse webpages. But while doing scroll in the UIWebView, everything freezes and no data is received. I've been searching and it has something to do with runloops and threads. But if the UIWebView can't run in another thread other than the main one, how can I receive data while doing scroll? It is critical to keep receiving data. The project uses the AsyncUdpSocket class from Cocoa AsyncSocket that works quite

UIToolbar items disappear - Weird bug in ios6

六月ゝ 毕业季﹏ 提交于 2020-01-04 04:34:15
问题 This is the current setup. I have the navigationController's toolbar with 5 buttons, and tapping on them hides the toolbar for 2 seconds, and then shows the toolbar again (except the 5th button - which brings up an actionsheet with buttons (ACTION & CANCEL)). On tapping on the 1-4 buttons, I do a self.navigationController.toolbarHidden = YES; and after exactly 2 seconds , I set the self.navigationController.toolbarHidden = NO; and this brings back the toolbar, and everything's fine. On

UItextView in UITableview, autocorrection bubble not visible

邮差的信 提交于 2020-01-04 04:31:07
问题 I have a UITableView with custom cells. The cells containing one UITextView each and the cell is resizing during user type text in the TextView. My problem is when user is on first row in a TextView autocorrection bubbles wont be visible in the current cell. Is there any workaround or can someone point me to another direction? alt text http://img340.imageshack.us/img340/5414/skrmavbild20100519kl092.png 回答1: If the cell is resizing as the user types, you could set the minimum height of the

Xcode4 templates now use underscore on iVars?

邮差的信 提交于 2020-01-04 03:56:23
问题 I have noticed that with Xcode4 Apple has updated the application templates to include underscores before instance variables. // Xcode4 @property (nonatomic, retain) IBOutlet UIWindow *window; @synthesize window = _window; . // Xcode3 @property (nonatomic, retain) IBOutlet UIWindow *window; @synthesize window; I know there are differing opinions on the usefulness of this but I was just curious if the updated templates where: (1) Highlighting a new best practice. (2) Showing how Apple does

Copy or retain NSString parameter?

烂漫一生 提交于 2020-01-04 02:40:08
问题 I'm developing an iOs 4 app with latest SDK and XCode 4.2 I have a question about NSString parameters. This is my class definition: #import <Foundation/Foundation.h> @interface BlogEntry : NSObject { NSString* title; NSString* text; NSDate* date; NSString* photo; } - (id)initWithTitle:(NSString*)titulo text:(NSString*)texto date:(NSDate*)fecha photo:(NSString*)foto; @end And implementation: #import "BlogEntry.h" @implementation BlogEntry - (id)initWithTitle:(NSString*)titulo text:(NSString*

How do you open a link in Safari from the Gmail app?

依然范特西╮ 提交于 2020-01-04 02:32:05
问题 I am sending out an email using the MFMailComposeViewController. MFMailComposeViewController* controller = [[MFMailComposeViewController alloc] init]; controller.mailComposeDelegate = self; [controller setSubject:@"subject"]; [controller setMessageBody:@"<a href=\"http://website.com\" target=\"_blank\">Link</a>." isHTML:YES ]; [self presentViewController:controller animated:YES completion:nil]; When the recipient opens this email in the default Mail app and taps the hyperlink, the page opens

Is this possible to force the iOS keyboard pop the English keyboard?

流过昼夜 提交于 2020-01-04 01:58:08
问题 If the user have more than one keyboard on their iOS devices. Is this possible to force to pop the English keyboard? Thanks. 回答1: From Text Programming Guide for iOS, The input method and layout for the keyboard is determined by the user’s language preferences There is no way afaik to force the language programmatically. Setting the iPhone keyboard language Change language of keyboard Hope that helps! 回答2: To implement the language preferences of different users, iOS also supports different