objective-c

UIView with transparent in middle

萝らか妹 提交于 2021-02-07 16:07:52
问题 Is it possible to create such a UIView fill with color, but in the middle is transparent? I'm thinking about to create 5 UIView s here. Just wondering is it possible to accomplish by using only ONE UIView 回答1: From Duncan C, I get to know where should I start, then I found CALayer with transparent hole in it. UIBezierPath *overlayPath = [UIBezierPath bezierPathWithRect:self.view.bounds]; UIBezierPath *transparentPath = [UIBezierPath bezierPathWithRect:CGRectMake(60, 120, 200, 200)];

Reusing Apple Sandbox security-scoped bookmarks

自作多情 提交于 2021-02-07 15:41:11
问题 I am creating a application which is reading files outside the application sandbox. I need the user's permission to read these files and I have got the security-scoped bookmarks to work, by making the user pick the path in a NSOpenPanel . My problem is that I don't want the user to give me permission every time the application accesses the same path. I am saving the bookmarks in the NSApplicationSupportDirectory folder. This works fine until the user restarts the computer, then it seems like

Reusing Apple Sandbox security-scoped bookmarks

本秂侑毒 提交于 2021-02-07 15:41:06
问题 I am creating a application which is reading files outside the application sandbox. I need the user's permission to read these files and I have got the security-scoped bookmarks to work, by making the user pick the path in a NSOpenPanel . My problem is that I don't want the user to give me permission every time the application accesses the same path. I am saving the bookmarks in the NSApplicationSupportDirectory folder. This works fine until the user restarts the computer, then it seems like

How to use AFNetworking 2 with Digest Authentication

旧巷老猫 提交于 2021-02-07 14:40:56
问题 I've been searching for "AFNetworking 2 with Digest Authentication" for a while and haven't found useful discussions about it (except this one, but unfortunately it looks like it's for AFNetworking 1). Here's my code without authentication: NSString* apiURL = @"https://api.example.com/WS.asmx"; AFHTTPSessionManager* manager = [AFHTTPSessionManager manager]; manager.requestSerializer = [AFJSONRequestSerializer serializer]; [manager GET:apiURL parameters: [NSDictionary

How to use AFNetworking 2 with Digest Authentication

北城余情 提交于 2021-02-07 14:40:41
问题 I've been searching for "AFNetworking 2 with Digest Authentication" for a while and haven't found useful discussions about it (except this one, but unfortunately it looks like it's for AFNetworking 1). Here's my code without authentication: NSString* apiURL = @"https://api.example.com/WS.asmx"; AFHTTPSessionManager* manager = [AFHTTPSessionManager manager]; manager.requestSerializer = [AFJSONRequestSerializer serializer]; [manager GET:apiURL parameters: [NSDictionary

Running performSelector: on an object that returns a double, not id

£可爱£侵袭症+ 提交于 2021-02-07 14:40:40
问题 How can I run an arbitrary selector on an object, the return of which is a double? For example, I have obj A, which has method -(double)blah; How can I do double res = [obj performSelector:@selector(blah)]; ? performSelector returns an id type object, so should I cast from id to NSInteger to double - that will lose precision? Also, I do not want to use the obj's methodSignatureForSelector (meaning, no NSMethodSignature and no NSInvocation ) because it is a huge CPU drain at run-time. 回答1: You

Running performSelector: on an object that returns a double, not id

纵饮孤独 提交于 2021-02-07 14:36:36
问题 How can I run an arbitrary selector on an object, the return of which is a double? For example, I have obj A, which has method -(double)blah; How can I do double res = [obj performSelector:@selector(blah)]; ? performSelector returns an id type object, so should I cast from id to NSInteger to double - that will lose precision? Also, I do not want to use the obj's methodSignatureForSelector (meaning, no NSMethodSignature and no NSInvocation ) because it is a huge CPU drain at run-time. 回答1: You

Custom class not shown in the storyboard identity inspector

守給你的承諾、 提交于 2021-02-07 14:32:31
问题 I created in my app a new class named EmpresasTableViewController , and in the storyboard I copied CategoriasViewController to EmpresasTableViewController, I just want to assign the class EmpresasTableViewController to EmpresasTableViewController in the storyboard, but the name EmpresasViewController doesn't appear in the Identity Inspector . There are no errors after creating the class, but why is it not shown as a class in the storyboard Identity Inspector under Custom Class ?, all other

Custom class not shown in the storyboard identity inspector

不打扰是莪最后的温柔 提交于 2021-02-07 14:31:00
问题 I created in my app a new class named EmpresasTableViewController , and in the storyboard I copied CategoriasViewController to EmpresasTableViewController, I just want to assign the class EmpresasTableViewController to EmpresasTableViewController in the storyboard, but the name EmpresasViewController doesn't appear in the Identity Inspector . There are no errors after creating the class, but why is it not shown as a class in the storyboard Identity Inspector under Custom Class ?, all other

Custom class not shown in the storyboard identity inspector

情到浓时终转凉″ 提交于 2021-02-07 14:30:33
问题 I created in my app a new class named EmpresasTableViewController , and in the storyboard I copied CategoriasViewController to EmpresasTableViewController, I just want to assign the class EmpresasTableViewController to EmpresasTableViewController in the storyboard, but the name EmpresasViewController doesn't appear in the Identity Inspector . There are no errors after creating the class, but why is it not shown as a class in the storyboard Identity Inspector under Custom Class ?, all other