cocoa-touch

Detect WatchKit extension presence in app

岁酱吖の 提交于 2019-12-25 05:27:11
问题 I have an app that I want to behave a bit differently when it comes to updates and caching if a WatchKit extension is installed on your paired Apple Watch than if it is not. If the watchkit extension has any chance of launching (you have paired a watch and the app is installed) then I want to do more heavy caching. Is there any way I can detect whether an Apple WatchKit Extension is installed on the Apple Watch from my iOS app? Other than setting a flag first time it is launched and hope it

Detect WatchKit extension presence in app

此生再无相见时 提交于 2019-12-25 05:27:08
问题 I have an app that I want to behave a bit differently when it comes to updates and caching if a WatchKit extension is installed on your paired Apple Watch than if it is not. If the watchkit extension has any chance of launching (you have paired a watch and the app is installed) then I want to do more heavy caching. Is there any way I can detect whether an Apple WatchKit Extension is installed on the Apple Watch from my iOS app? Other than setting a flag first time it is launched and hope it

Iphone application, object oriented design ideas

孤人 提交于 2019-12-25 05:19:08
问题 I am a java developer learning Objective C for an IPhone project, my question is about the OOP design in Cocoa. I have a view based application which communicates with a web service and recives an xml, parse it and map its contens an appropriate view component (e.g if thats a date show the question with datepicker, if question has 2 values show it with a segmented control, if more with a pickerview..etc) so its a dynamic questionary with many pages. What is the best design possible here

In iOS, can a UIButton be added by alloc and initWithFrame?

柔情痞子 提交于 2019-12-25 05:15:27
问题 A button can be added by: UIButton *myButton = [UIButton buttonWithType:UIButtonTypeRoundedRect]; myButton.frame = CGRectMake(100, 100, 160, 50); [myButton setTitle:@"click me" forState:UIControlStateNormal]; [self.view addSubview:myButton]; but can we go with the initWithFrame method: UIButton *myButton2 = [[UIButton alloc] initWithFrame:CGRectMake(100, 300, 160, 50)]; //myButton2.buttonType = UIButtonTypeRoundedRect; myButton2.titleLabel.text = @"click me"; [self.view addSubview:myButton2];

In iOS, can a UIButton be added by alloc and initWithFrame?

做~自己de王妃 提交于 2019-12-25 05:15:02
问题 A button can be added by: UIButton *myButton = [UIButton buttonWithType:UIButtonTypeRoundedRect]; myButton.frame = CGRectMake(100, 100, 160, 50); [myButton setTitle:@"click me" forState:UIControlStateNormal]; [self.view addSubview:myButton]; but can we go with the initWithFrame method: UIButton *myButton2 = [[UIButton alloc] initWithFrame:CGRectMake(100, 300, 160, 50)]; //myButton2.buttonType = UIButtonTypeRoundedRect; myButton2.titleLabel.text = @"click me"; [self.view addSubview:myButton2];

Customize Highlight Image on TabBar

﹥>﹥吖頭↗ 提交于 2019-12-25 05:14:52
问题 I want to replace the normal highlight with an image on tabbar. What is the simplest way to do this on iOS4 and iOS5?? 回答1: This is super easy in iOS 5 (see the "Customizing Appearance" section of Apple's UITabBar documentation). If your client is insisting on iOS 4, you'll have to be a bit more creative. Consider subclassing UITabBar or UITabBarController and doing some drawing of your own. Here is an example (and another example and another example which has an answer which points to

Adding silence to the end of a recorded audio file

喜欢而已 提交于 2019-12-25 04:59:07
问题 Currently I'm allowing user to record their own voice for a duration no longer than 30 seconds. Once they are finished recording their audio, I grab the duration of their audio. I run this quick math (SixtySeconds-TheirAudioDuraion) = TimeNeededToFill. Basically I need to end up with a precise 1-minute track in the end. Some portion of which is actual Audio, the remainder is Silent Audio. Im currently using AVAudioPlayer to do all of my audio recording. Is there a programatic way to

iOS app launch takes too long to display

大憨熊 提交于 2019-12-25 04:58:38
问题 Working on first app, have most of the programming done but app is taking too long at launch to display first tableview on tabbar. It takes 8-10 seconds on launch to display. Looking for help on tracking down what code is taking so long, etc. Here is the general app setup: tabbar with 5 tabs including navigation bars, mix of tableviews with detail views and scrollviews. The data for the tableviews is from multiple json feed from a remote web server. In the appdelegate.m I'm setting up the

Memory issue with [NSData dataWithContentsOfFile]

点点圈 提交于 2019-12-25 04:58:38
问题 I am developing application which required image caching. For doing this, I am using JMImageCache library. It is work fine for caching. But It can not release memory occupied by following line. [NSData dataWithContentsOfFile] Here, is function which content code for cache image from disk. - (UIImage *) imageFromDiskForURL:(NSString *)url { NSData *data = [NSData dataWithContentsOfFile:cachePathForURL(url) options:0 error:NULL]; UIImage *i = [[[UIImage alloc] initWithData:data] autorelease];

Debugging strategies when UITableView's cells don't load?

送分小仙女□ 提交于 2019-12-25 04:57:15
问题 I am trying to embed a UITableView into my ViewController's main UIView that is 75% the width of the screen. Ideally this UITableView would also be embedded into a Navigation Controller. Also, it seems I cannot use UIContainerViews with iOS 5 because I encounter the error "Could not instantiate class named UIStoryboardEmbedSegueTemplate" (cf. NSInvalidUnarchiveOperationException with ContainerView). To do this, I have created a UIView within my ViewController's main UIView that is 75% the