天道酬勤,学无止境

iphone

UIButton not showing the text in iOS6

I am working with iOS6 and Xcode 4.5, I am getting an UI issue with some UIButton, some of the buttons title are not getting shown in my view. In an older version of iOS everything works as expected. Please see the following image. It's not showing the text "Button" while executing it on simulator

2022-01-19 02:41:19    分类:问答    iphone   objective-c   ios   xcode

sectioned tableview index selection highlighting

I feel this should be a simple property, but for the life of me I've searched and cannot find the answer. I have a tableview index to the right of my table. When selected, it grays out everything. I'd like to mimic the iPod app, whereby when the index itself is selected, it is semi-transparent (alpha of maybe .4f). Any ideas?

2022-01-19 02:39:48    分类:问答    iphone   objective-c   ios   uitableview

iOS: addConstraints: crashing app

Problem I can't seem to adopt Auto Layout into my existing project. Details I was having the same issue before as this question presentViewController: crash on iOS <6 (AutoLayout) but none of the provided answers were a solution for me: I'm using all storyboard views with no xibs. My 'Use Auto Layout' setting is already turned off and I am using nothing but iOS 6. My view controller was initially crashing, so I set the constraints to be added with a delay and now my app crashes during any addConstraints: call. Worst part is that it won't tell me why. Code I will link my code, but its pretty

2022-01-19 02:37:07    分类:问答    iphone   objective-c   ios   nslayoutconstraint

Checking for valid IP for connection with NSURLConnection

I currently have an ap that attempts to open a webview based on certain servers I am communicating with. However, I allow the user the capability to type in their own server IPs in case both the iphone/ipad and server(or other device) are not on the same network. However, I am attempting to use NSURLConnection to detect if I can open a connection with the given IP however NSURLConnection never returns an error, even if the server address(or even a random web address) is completely bogus. the .h @interface DetailViewController : UIViewController <UIPopoverControllerDelegate

2022-01-19 02:20:45    分类:问答    iphone   objective-c   ios   xcode

sqlite 3 opening issue

I'm getting my data ,with several similar methods, from sqlite3 file like in following code: -(NSMutableArray *) getCountersByID:(NSString *) championID{ NSMutableArray *arrayOfCounters; arrayOfCounters = [[NSMutableArray alloc] init]; @try { NSFileManager *fileManager = [NSFileManager defaultManager]; NSString *databasePath = [[[NSBundle mainBundle] resourcePath ]stringByAppendingPathComponent:@"DatabaseCounters.sqlite"]; BOOL success = [fileManager fileExistsAtPath:databasePath]; if (!success) { NSLog(@"cannot connect to Database! at filepath %@",databasePath); } else{ NSLog (@"SUCCESS

2022-01-19 02:17:26    分类:问答    iphone   ios   xcode   sqlite

loading a nib file that is instantiated from a storyboard

So I am pretty new to this story board concept. I have a view nibs dropped in to the storyboard and each corresponding to a UIViewController subclass I have, I tried loading the nib file using the following code: TestViewController *vc = [[TestViewController alloc] initWithNibName:@"TestViewController" bundle:nil]; [self.view setBackgroundColor:[UIColor blueColor]]; [self.view setFrame:CGRectMake(0, self.profilePicture_.frameHeight + self.profilePicture_.frameY + 10, self.scrollView_.frameWidth, 100)]; [self.view addSubview:vc.view]; However, it gives me the following error: *** Terminating

2022-01-19 01:52:40    分类:问答    iphone   objective-c   ios   ipad

Launch image for custom url - storyboard or asset catalog

I'm trying to have a custom launch image when a custom url launches the app. Is there a way to specify either a custom storyboard (UILaunchStoryboardName) or image from the asset catalog to use in this scenario?

2022-01-19 01:31:17    分类:问答    ios   iphone   launchimage   uilaunchimagefile

Proper way to connect UIActionSheet options to actions

While using a UIActionSheet in an iphone app, the typical methods of matching actions to buttons seem very fragile and aesthetically unpleasant. Perhaps its due to my minimal C/C++ background (more Perl, Java, Lisp and others). Matching on button indexes just seems like too many magic numbers and too disconnected to avoid simple logical or consistency errors. For instance, UIActionSheet *sources = [[UIActionSheet alloc] initWithTitle:@"Social Networks" delegate:self cancelButtonTitle:@"Cancel" destructiveButtonTitle:nil otherButtonTitles:@"Twitter", @"Facebook", @"Myspace", @"LinkedIn", @

2022-01-19 00:35:23    分类:问答    iphone   objective-c   design-patterns   uiactionsheet

Handle control buttons of UIwebview youtube video player

I'm creating a youtube videos player which can play a list of youtube video ( given a list of video id). I embedded youtube video into a UIWebview as following: NSString *htmlFormat = @"<html><head><body style=\"margin:0\"><embed id=\"yt\" src=\"%@\" type=\"application/x-shockwave-flash\" width=\"40\" height=\"30\"></embed></body></html>"; NSString *url = [NSString stringWithFormat:@"http://www.youtube.com/watch?v=%@", videoId]; NSString *html = [NSString stringWithFormat:htmlFormat, url]; [webView loadHTMLString:html baseURL:nil]; What i need are: Next video is played automatically when

2022-01-18 23:30:53    分类:问答    iphone   ios   uiwebview   youtube

How can I underline part of the text like iPhone SMS?

I use an UILabel to show my text, in a multi-line and UILineBreakModeWordWrap mode, and the maximum width is 200. For example, here is the text: I really really want to underline first word and second word, could you help me? And I want to underline "first word" and "second word". If the text is shown in a single-line mode, with sizeWithFont method of NSString, I can easily calculate the position of "first word" and then override - (void)drawTextInRect:(CGRect)rect to draw the line. But in multi-line mode, I don't know how to get the position. Do you have any idea?

2022-01-18 23:28:36    分类:问答    iphone   nsstring   uilabel