cocoa-touch

iOS5, StoryBoards, ARC: Weird categories issue

跟風遠走 提交于 2019-12-24 10:36:34
问题 I've created a file with sql methods and now this file is really large. I'd like to split it for best practice and implementation simplicity. So, categories. I've created in xCode new objective-c categories file -> DBAccess+Generals.h (.m). .h: #import "DBAccess.h" @interface DBAccess (Generals) -(void)newMeth; @end .m #import "DBAccess+Generals.h" #import "DBAccess.h" @implementation DBAccess (Generals) -(void)newMeth { NSLog(@"New Meth"); } @end In DBAccess.h #import <Foundation/Foundation

Is there any performance or memory overhead using UIImage or UILabel or NSString in Quartz2D

纵然是瞬间 提交于 2019-12-24 10:23:08
问题 Is there any performance or memory overhead using UIImage or UILabel or NSString in Quartz2D . If there is no difference then why not use UIImage , UILabel etc. Can any one send me the snippet how to draw image without using UIImage . Thanks in advance, Regards. please correct me if you see any stupid mistake I am new to this, trying to learn it. 回答1: A label draws a string. You can't have a label without a string; if you did, what would it draw? Last I checked, UILabel uses UIWebView

Dictionary Key Sort Options - Alpha then Numeric

 ̄綄美尐妖づ 提交于 2019-12-24 10:08:57
问题 All, I would like to sort this mutable dictionary of arrays keys like so: A-Z 0-9 but it's coming back sorted 0-9 A-Z. How can I sort it such that the alpha chars come before the numbers? Perhaps there is a built-in method that does this or should I create a category that extends NSString? NSArray *sKeysArray = [[listContent allKeys] sortedArrayUsingSelector:@selector(caseInsensitiveCompare:)]; NSString *sectionKey = [sKeysArray objectAtIndex:section]; NSArray *sectionValues = [listContent

In Cocos2d, with buttons on multiple layers, how can I control which button to react to user's touch?

妖精的绣舞 提交于 2019-12-24 10:04:27
问题 Now I have a CCLayer of gameplay, where there are a few buttons. And I want to pop up a dialog layer, where there are also a few buttons. How can I deactivate the background buttons and only make the foreground buttons activated? 回答1: Use CCMenuItem setIsEnabled method to disable button. 回答2: What about a lot of buttons on gameplay? Disable every button looks like not the best solution... Is it possible to disactivate all buttons in one fell swoop as topic starter requested? 来源: https:/

UITextField autocomplete

廉价感情. 提交于 2019-12-24 10:04:09
问题 Is it possible to autocomplete a UITextField bases on what is being entered? The reason why I need this is because I have a predefined set of words that the user needs to choose and the list is about 1000 item long. I want to display in UITableView and let the user chose but having 1k items in table list isn't I think a good idea. Thanks 回答1: You can do it by not showing all the 1k items in table view but you can populate your table view as the user starts typing letters in text field. For

How to use pure C files in an objective-c project?

天涯浪子 提交于 2019-12-24 09:43:23
问题 Simple question: I have created a bunch of C helper routines and am trying to include them in a project. I had assumed something like the following would be ok. MyFuncs.h typedef struct { float n; } MyStruct; float Operation(MyStruct ms); MyFuncs.m #import "MyFuncs.h" float Operation(MyStruct ms) { return ms.n * ms.n; } However, I'm getting a linker error "Undefined symbols for architecture i386" and "Operation(MyStruct) referenced from x" Is there some other way that header/implemenation C

Stopping CoreLocation background updates

无人久伴 提交于 2019-12-24 09:39:16
问题 My app registers for background location updates (not Significant Change. I need more granularity than kilometers) That part works fine. I just want to stop the updates after the app has been in the background for 60 minutes. The way I'm doing it right now is to call stopUpdatingLocation in my CLLocationManager delegate. However, I am unsure if this will actually stop my app from receiving background location updates, or if it will , but will just ignore them. Ideally, I'd like to not have my

Send app to background on button tap

回眸只為那壹抹淺笑 提交于 2019-12-24 09:38:54
问题 In my apps there is a button named "Back". When the user clicks on that button, the apps should be sent to the background, like when we click on the home button. 回答1: Even if you manage to do this, it is against Apple's HIG (because it will look as a crash to the user) - if you plan to publish your app on the AppStore you'll be rejected. 回答2: I think turning to background is impossible. Make user press home button by using UIAlertView with no cancel button. 回答3: We can send an application to

can web offline app access local file?

社会主义新天地 提交于 2019-12-24 09:38:26
问题 Hi guys: I am woking on creating a offline-web application. I hope it can be run in UIWebView(iOS) or WebView(Android). I don't know if it does work. The html and javascript files work fine now, but my apps need to process some binary files which is defined by myself, and these files are dynamic created so they can not be put in off-line cache manifest. If the web pages are loaded in web browser from web server, I can read the binary files through XMLHttpRequest. But if the browser open the

Populating malloc-ed array with CLLocationCoordinate2D

∥☆過路亽.° 提交于 2019-12-24 09:37:31
问题 So far I have been very impressed with Objective-C and the Cocoa Frameworks but I have to say that I am a little confused by the best way to create an array of CLLocationCoordinate2D to pass to the polylineWithCoordinates:count: I am pretty sure that this is how I need to setup the array. NSUInteger numPoints = [locationData count]; CLLocationCoordinate2D *arrayPtr = malloc(numPoints * sizeof(CLLocationCoordinate2D)); But I am not sure how to access each location, I thought I could use