iphone-sdk-3.0

Set First Responder in MFMailComposeViewController?

烈酒焚心 提交于 2019-11-29 07:14:32
I'm using Apple's MailComposer example application to send email from within my application (OS 3.0 functionality). Is it possible to set the To, Subject, or Body fields as first responder with MFMailComposeViewController? In other words, the behavior would be: the user presses a button which presents the mail view (presentModalViewController). When the mail view is presented, the cursor is placed in one of the fields and the keyboard opens. I notice the MFMailComposeViewController documentation says: "Important: The mail composition interface itself is not customizable and must not be

Why is my app delegate's didFinishLaunchingWithOptions method all of sudden being called AFTER my RootViewController:viewDidLoad method?

二次信任 提交于 2019-11-29 07:10:55
I've been playing with the iPad's SplitView template in Xcode. Here are two of the many important methods that are auto-generated for you by the Split View-based Application template... AppNameAppDelegate.m #pragma mark - #pragma mark Application lifecycle - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { // Override point for customization after app launch rootViewController.managedObjectContext = self.managedObjectContext; // Add the split view controller's view to the window and display. [window addSubview:splitViewController.view

How to Sort an NSMutableArray of Managed Objects through an object graph

六眼飞鱼酱① 提交于 2019-11-29 06:11:14
I'm new to Apple's iPhone 3.0 SDK support of Core Data and I'm relatively new to iPhone development. My question is on slightly more "complex" sorting than is covered in the docs. I suspect that I am making an incorrect, fundamental assumption. How can I sort a pre-fetched collection of managed objects by a property contained several layers deeper in the collection? Example: Farm has a 1 to many to Cowboy (Farm.cowboys) Cowboy has a 1 to 1 to Person (Cowboy.person) Person has lastName (Person.lastName) The entire object graph has been fetched and the cowboys are displayed through a UITableView

Frame load interrupted error while loading a word document in UIWebView

微笑、不失礼 提交于 2019-11-29 06:00:43
I want to load a word document using UIWebView. I used the code provided in http://developer.apple.com/iphone/library/qa/qa2008/qa1630.html to load the document. But not all the documents load successfully. Sometimes I get an error Error Domain=WebKitErrorDomain Code=102 UserInfo=0x145bc10 "Frame load interrupted" The error seems to be very sporadic and I get this error only for some documents. However the same document loads correctly in mail.app. What am I missing? The reason was, the file I tried to load doesn't contain a extension. I was purposely removing the file extension (.doc and .ppt

cocoa - I've discovered what I think is a bug with NSDecimalNumber

为君一笑 提交于 2019-11-29 04:49:49
Here is a simple code that shows what I think is a bug when dealing with double numbers... double wtf = 36.76662445068359375000; id xxx = [NSDecimalNumber numberWithDouble: wtf]; NSString *myBug = [xxx stringValue]; NSLog(@"%.20f", wtf); NSLog(@"%@", myBug); NSLog(@"-------\n"); the terminal will show two different numbers 36.76662445068359375000 and 36.76662445068359168 Is this a bug or am I missing something? if the second number is being rounded, it is a very strange rounding btw... = = = = = = = = = = I am editing the original question to include one more WTF bug... try this: modify the

Question regarding SharedInstance

泪湿孤枕 提交于 2019-11-29 04:36:20
Hey guys, I wanna ask, what is sharedInstance actually? I mean what is the usage? Currently I'm having some problem in communicating between 2 different files. Here's my question: I have 1 file call A.h/A.m and another file call B.h/B.m A.h need to access some of the data in B.h, so .... is there any possible way I could achieve what I want? Just wonder is it "SharedInstance" able to solve my problem? Looking for reply :) sharedInstance could be used for several ways. For example you can access an object from a static context. Actually it is used most ways for supporting the Singleton-pattern.

wait_fences: failed to receive reply: 10004003 - what?

ぃ、小莉子 提交于 2019-11-29 04:33:23
Been getting this odd error. heres the deal - in the below method i have an alert view come up, take a U/N and PW, then atempt to start another method. The method -postTweet does not get activated I just get this error in console wait_fences: failed to receive reply: 10004003 Which is really odd - as ive never seen it before - (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex{ if (alertView == completeAlert ) { if (buttonIndex ==1) { passPromtAlert = [[UIAlertView alloc] initWithTitle:@"Enter Name" message:@"Please enter your Username and password - they will

How to detect shake motion in iPhone

余生颓废 提交于 2019-11-29 03:41:28
On the shake of the iPhone device i want some function to be called, i dont know how to recognize shake so i tried some link and tried this code - (void)motionBegan:(UIEventSubtype)motion withEvent:(UIEvent *)event { if(event.type == UIEventSubtypeMotionShake) { NSLog(@"called"); [self.view setBackgroundColor:[UIColor greenColor]]; } } - (BOOL)canBecomeFirstResponder { return YES; } But alas no luck so can you please let me know how i can do the same Thanks and Regards As per the above comments discussed i am answering my question so that others can read the solution that i have got In the

iPhone sdk - open app store to specific app?

对着背影说爱祢 提交于 2019-11-29 02:56:53
Is there a way to open the app store to a specific application? I tried using something like the following: [[UIApplication sharedApplication] openURL: [NSURL URLWithString:@"http://itunes.apple.com/WebObjects/MZStore.woa/wa/viewSoftware?id=284417350&mt=8&uo=6"]]; But got the following: "Safari cannot open the page because to many redirects occurred". Kyle Apparently this issue only affects the simulator. A build an go on the device works perfect. MrMage Use http://itunes.com/app/YourAppNameWithoutSpaces See also this. Another simple way is: [[UIApplication sharedApplication] openURL: [NSURL

MKMapView : setRegion doesn't work !

浪子不回头ぞ 提交于 2019-11-29 02:37:11
Aaaarg... ok, let's calm myself. Did someone have any problem with setting the region of a MKMapView ? It never worked with me. This code : -(void)setUserCenteredSpan:(MKCoordinateSpan)span{ // for this example, span = {0.5, 0.5} // Current region (just initialised) NSLog(@"%f, %f - %f, %f", self.region.center.latitude, self.region.center.longitude, self.region.span.latitudeDelta, self.region.span.longitudeDelta); // New Region MKCoordinateRegion region = MKCoordinateRegionMake([[[self userLocation] location] coordinate], span); NSLog(@"%f, %f - %f, %f", region.center.latitude, region.center