Re: Cocoa-dev Digest, Vol 10, Issue 633
Thanks Jerry. I don't know how i went by the documentation and didn't see this method :S As for the size of the window, the view is somewhat mangled with buttons overlapping at this size. Yet the user can review its data in versions. Regards. On Oct 3, 2013, at 7:59 PM, cocoa-dev-requ...@lists.apple.com wrote: Date: Thu, 03 Oct 2013 06:27:35 -0700 From: Jerry Krinock je...@ieee.org To: Cocoa Developers cocoa-dev@lists.apple.com Subject: Re: Window too large for Versions Browser Message-ID: e248f4e2-9edd-464a-93dc-49525d473...@ieee.org Content-Type: text/plain; charset=us-ascii On 2013 Oct 03, at 00:12, Half Activist halfactiv...@gmail.com wrote: Well, the minSize is actually correctly set but that doesn't seem to be small enough for Versions on small desktops, I found a solution by implemeting the NSWindowDelegate methods below to set the minSize to 640x480 when entering Versions, and setting it back to 1200x680 when exiting. I think that you need to give this more thought. First of all, the intended method where you should resize your window for the versions browser is -window:willResizeForVersionBrowserWithMaxPreferredSize:maxAllowedSize: is , not -windowWillEnterVersionBrowser: If you used that method, then you will get an allowed size which is commensurate with the current display resolution, and would not need to hard-code it to the minimum known size, which could get smaller if, for example, Apple someday decides to put OS X on an iPad or iWatch :)) And then there is the issue of how your app works normally on small screens, with a minSize of {1200, 680} for that window. Finally, that minSize is supposed to be the absolute minimum that works. If you can change it from {1200, 680} down to {640, 840}, then {1200, 680} was not really a minimum! And, out of curiosity, I assume you are testing this with your display resolution set to some very small value? And it works OK without those delegate method implementations if you test it with larger display resolution? ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
To find if a binary is being used/running
Hi, I need to know if a binary is executing or not. I just have the path to the binary e.g. /Applications/MyApp.app/Contents/MacOS/MyApp There's NSRunningApplication method runningApplicationsWithBundleIdentifier: , but I have other binaries which are embedded in this app which don't have a bundle id. And I want to know if they are running or not. Cocoa doesn't seem have any such specific API for this purpose. NSFileHandle provides a valid handle (for writing) even if the binary is executing. Is there any method like open() or something which would fail if binary is executing. Tried open() with flags O_EXLOCK but no luck yet. Is this even possible? Best, Nick ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: To find if a binary is being used/running
On Oct 4, 2013, at 12:08 AM, Nick Rogers roger...@mac.com wrote: Hi, I need to know if a binary is executing or not. I just have the path to the binary e.g. /Applications/MyApp.app/Contents/MacOS/MyApp From the OS’s point of view, your question is ill-formed. The user can create a hardlink to the same inode at /tmp/someapp and execute that. Is this even possible? I can think of a couple strategies: 1. Have the target app create a resource that goes away when the app terminates. Maybe a pipe? Something that the system will destroy when the helper app terminates. 2. Move your helper apps to XPC services. (Almost certainly Apple’s preferred approach.) --Kyle Sluder ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Updating provisioning profiles xCode 5
Hi, Xcode 5 - Preferences - Accounts - View Details - Update will reload all profiles from the developer portal… Am 27.09.2013 um 14:10 schrieb Kevin Muldoon caoimgh...@gmail.com: Used to be I could manage my development provisioning profiles in the Organizer. Or I could update development profile in Apple Portal with new devices, download, double-click and viola! Neither seems to be the case now. Has this moved or have I gone blind? ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/oliver%40werk01.de This email sent to oli...@werk01.de Oliver Michalak: Coder @ iPhone, Mac, Web, ^(.*)$ [werk01] • +49-171-2078046 • oliver.werk01.de ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Transparent Image with Tint Color
If you're targeting iOS 7, then you should take a look at WWDC session 214 (Customizing Your App’s Appearance for iOS 7). It talks about using the method on UIImage called imageWithRenderingMode:, which lets you use the tintColor property to tint your generic images in code. If you're targeting iOS 6 and below, then check out the tutorial by thoughtbot that uses blending modes to colour an image. http://robots.thoughtbot.com/post/46668544473/designing-for-ios-blending-modes Hope that helps, Cai On 29 September 2013 16:15, Paul Scott psc...@skycoast.us wrote: I have an image file—created in Photoshop, anti-aliasd against a transparent background—that I would like colorized using the same tint color used in the navigation bar. Is there a way to colorize this pre-drawn image programmatically? -- Paul Scott psc...@skycoast.us ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/cai.durbin%40gmail.com This email sent to cai.dur...@gmail.com ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Identify extension of a file without extension
1) There's also MagicKit, an Obj-C wrapper around libmagic: https://github.com/aidansteele/MagicKit 2) If you just want to know if something is an image, just try loading it: [[NSImage alloc] initWithData:data] If -initWithData: returns nil, it is not an image. Jakob On 28.09.2013, at 23:29, Charles Srstka cocoa...@charlessoft.com wrote: On Sep 28, 2013, at 4:17 PM, Devarshi Kulshreshtha devarshi.bluec...@gmail.com wrote: 1. Is there any other way to identify file extension for the files without extensions, say from NSData object? Have a look at the files in /usr/share/file/magic/ to get some ideas of how to identify various types of files. Charles ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/jakob%40eggerapps.at This email sent to ja...@eggerapps.at ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: NSOutlineView cell size 8 pixels too narrow
I had a similar issue with NSOutlineView in 10.8. I had an outline view that could be hidden by the user, and every time it was shown again, the width of the outline column shrank by a certain amount. It might be a bug in NSOutlineView. Calling -reloadData after the view is shown fixed the issue for me. On 02.10.2013, at 00:38, Trygve Inda cocoa...@xericdesign.com wrote: My cell width is 8 pixels too narrow until I resize the window (even by only a pixel). It is as if the auto-sizing is not working when it is loaded from the nib. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: How to get a Normal button in iOS 7/IB
On 4 Oct 2013, at 00:05, Robert Martin robmar...@frontiernet.net wrote: You presented a problem, and other members spent their precious time trying to help you solve it. Just take it or leave it, but thank them all the same. This thread isn't finished and at the end of it I will thank them and report my finding as I usually do. Your opinion of a framework is irrelevant, please stop wasting bandwidth. Your opinion of my opinion of a framework is irrelevant, please stop wasting bandwidth. All the Best Dave ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: How to get a Normal button in iOS 7/IB / One Solution
Thanks a lot Ronald, that's great, I think I will add this as subclass of UIButton! Dave On 4 Oct 2013, at 03:48, Ronald Hofmann pro...@jumbosoft.de wrote: This is a fully configurable, common, all garden, down to earth, no messing around - Button code snippet generated by UI Tuner. //*** // UI Tuner - v1.2 // Auto generated code // Generated on: 04-10-2013 00:29 // Deployment Target: iOS 6.0 //*** - (UIButton*)generateUITunerObject { UIButton *myObject= [UIButton buttonWithType:UIButtonTypeRoundedRect]; [myObject setTitle:@Normal State forState:UIControlStateNormal]; [myObject setTitle:@Normal State forState:UIControlStateHighlighted]; [myObject setTitle:@Normal State forState:UIControlStateDisabled]; [myObject setTitleColor:[UIColor darkGrayColor] forState:UIControlStateNormal]; [myObject setTitleColor:[UIColor whiteColor] forState:UIControlStateHighlighted]; [myObject setTitleColor:[UIColor grayColor] forState:UIControlStateDisabled]; [myObject setTitleShadowColor:[UIColor colorWithWhite:0.00 alpha:0.50] forState:UIControlStateNormal]; [myObject setTitleShadowColor:[UIColor colorWithWhite:0.00 alpha:0.50] forState:UIControlStateHighlighted]; [myObject setTitleShadowColor:[UIColor colorWithWhite:0.00 alpha:0.50] forState:UIControlStateDisabled]; myObject.reversesTitleShadowWhenHighlighted = NO; myObject.titleLabel.font = [UIFont boldSystemFontOfSize:15]; myObject.titleLabel.lineBreakMode = NSLineBreakByTruncatingMiddle; myObject.titleLabel.shadowOffset = CGSizeMake (0, 0); myObject.adjustsImageWhenHighlighted = YES; myObject.adjustsImageWhenDisabled = YES; myObject.tintColor= nil; myObject.contentEdgeInsets= UIEdgeInsetsMake (0, 0, 0, 0); myObject.titleEdgeInsets = UIEdgeInsetsMake (0, 0, 0, 0); myObject.imageEdgeInsets = UIEdgeInsetsMake (0, 0, 0, 0); myObject.enabled = YES; myObject.highlighted = NO; myObject.selected = NO; myObject.contentHorizontalAlignment = UIControlContentHorizontalAlignmentCenter; myObject.contentVerticalAlignment = UIControlContentVerticalAlignmentCenter; myObject.frame= CGRectMake (333, 33, 156, 44); myObject.bounds = CGRectMake (0, 0, 156, 44); myObject.center = CGPointMake (411, 55); myObject.transform= CGAffineTransformIdentity; myObject.backgroundColor = nil; myObject.hidden = NO; myObject.alpha= 1.00; myObject.clipsToBounds= NO; myObject.layer.borderWidth= 0.00; myObject.layer.borderColor= [[UIColor colorWithRed:0.00 green:0.00 blue:0.00 alpha:1.00] CGColor]; myObject.layer.cornerRadius = 0.00; myObject.layer.shadowColor= [[UIColor colorWithRed:0.00 green:0.00 blue:0.00 alpha:1.00] CGColor]; myObject.layer.shadowOffset = CGSizeMake (0, -3); myObject.layer.shadowOpacity = 0.00; myObject.layer.shadowRadius = 3.00; myObject.layer.masksToBounds = NO; return myObject; } // generateUITunerObject Regards Ronald Hofmann ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: NSOutlineView cell size 8 pixels too narrow
I wonder if this is a side-effect of -[NSOutlineView autoresizesOutlineColumn]. I had to set it to NO for our app. On 2 Oct 2013, at 11:57, Jakob Egger ja...@eggerapps.at wrote: I had a similar issue with NSOutlineView in 10.8. I had an outline view that could be hidden by the user, and every time it was shown again, the width of the outline column shrank by a certain amount. It might be a bug in NSOutlineView. Calling -reloadData after the view is shown fixed the issue for me. On 02.10.2013, at 00:38, Trygve Inda cocoa...@xericdesign.com wrote: My cell width is 8 pixels too narrow until I resize the window (even by only a pixel). It is as if the auto-sizing is not working when it is loaded from the nib. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/mabdullah%40karelia.com This email sent to mabdul...@karelia.com ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: How to get a Normal button in iOS 7/IB
Hi, Using the cap approach sounds good, but it's way to much work for these 5 apps I have to modify. It's all a bit mute now anyway. since I've just come out of a meeting and, because of all this Button nonsense (as well as other UI issues) we are not going to support iOS 7 for these Apps for a while if ever. They work find on iOS 6 and the Users won't be upgrading their pads to iOS 7, so it really doesn't matter. I'm pleased because I was dreading having to change a *lot* of Button code just to get back what we already had a few days ago under iOS 6! Thanks a lot for everyone's time and at least I know how to do it now if we ever need to. All the Best Dave On 4 Oct 2013, at 00:52, Alex Zavatone z...@mac.com wrote: The cap approach is something that's supported with a standard button and it works really well. FWIW, I've been using it since 1998 with PNGs. Basically, the approach is that you have a PNG graphic that is nicely antialiased and alpha channeled. It consists of a button's left and right caps and a middle region that is a stretchable column of pixels. When making the button, and assigning the graphic, you define how many pixels are used in the left and right caps and the middle is taken from the middle column of pixels. Make sure to have a graphic that consists of the left, right and middle for each state of the button, such as active and clickable/tappable, active/over, down, selected, disabled. It works like a charm. I've even got some of these PNGs if you need to try it out on a UIButton. There are more advanced ways to make buttons with gradients by creating the image in code, but just creating a set of capped images for the button graphics is a pretty easy way to go. Lots of how some frameworks are implemented might not make sense and might suck to you. You'll find that the frameworks are how the frameworks are, like it or not. I'm sure that there are loads of custom button classes out there that you can find on Github or StackExchange that create buttons in code the way you expect. Whether something like this should be in the UIButton class or not, well - it probably should be, but it isn't and it's up to us to see how to deal with that. Might be a good little project for a class extension category for you to build out. On Oct 3, 2013, at 5:39 PM, Dave wrote: On 3 Oct 2013, at 21:13, Fritz Anderson fri...@manoverboard.org wrote: On 3 Oct 2013, at 2:09 PM, Dave d...@looktowindward.com wrote: Sorry, should have said, without using an Image. Why? Images are how this sort of thing gets done. Anything else is a stunt, unless you have some constraint you're not telling us about. (You're familiar with -[UIImage resizableImageWithCapInsets:] and related API?) I suppose (off the top of my head, not even written in Mail), you could have a UIButton subclass that returns a CALayer subclass of your devising from +layerClass, and have your layer set borders and corner-rounding. I really don't want to make lots of images just for this and to be honest, if a Framework doesn't support an Industry Standard Button out of the box, then, it sucks! Thanks Dave ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/zav%40mac.com This email sent to z...@mac.com ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Can I create a thread with a runloop and a dispatch queue?
On 03.10.2013, at 22:00, Jens Alfke j...@mooseyard.com wrote: On Oct 3, 2013, at 12:17 PM, Kyle Sluder k...@ksluder.com wrote: What is adopting GCD going to get you if you aren't going to use GCD the way it was intended? … Also, my project is a library, and I don’t want to put too many restrictions on how it’s used by the caller. For example, here’s one method that runs an async query: - (void) runAsync: (void (^)(CBLQueryEnumerator*))onComplete; When the query results are available, the onComplete block is called. The problem is, in what context should the block be called? Ideally, the execution context is implementation defined. It is actually a dedicated private thread or private dispatch queue. Currently it’s scheduled on the same runloop as the original call. Scheduling or dispatching a callback or block onto a known thread/queue will increase the risk for a dead lock. Thus, the execution context of the callback shall be created/selected by the asynchronous result provider and should not be accessible by the call-site. If the call-site wishes to handle the callback code on a particular execution context it can easily do that through dispatching the code on that queue/thread. That works great for runloop-based clients. If the client knowns about the risks (namely dead-locks), then perhaps yes. ;) But if this method is called from a dispatch queue (except the main one) it won’t work. Possibly, a different design will solve potentially problems: instead exposing the execution context, just make it a private property of the asynchronous result provider. Suppose you have some asynchronous task (a class, not unlike an NSOperation), whose responsibility is to take an NSInputStream and copy it into an NSOutputStream. The principal API may look as follows: @interface StreamToStreamCopier : NSObject AsynchronousOperation - (void) initWithSourceStream:(NSInputStream*)sourceStream destinationStream:(NSOutputStream*)destinationStream completion:(completion_block_t)completionHandler; - (void) start; // AsynchronousOperation - (void) cancel; // AsynchronousOperation @property (nonatomic, copy) completion_block_t completionHandler; // AsynchronousOperation @end // For StreamToStreamCopier the parameter result is the destinationStream typedef void(^ completion_block_t)(id)result, NSError*error); Here, *where* the completion handler will be actually executed is completely irrelevant! Even when it sometimes gets possible to dispatch NSStream on dispatch queues, the API won't change. Furthermore, it seems reasonable that, internally, the StreamToStreamCopier uses NSStream delegates, and hence run loops. Just, there's seems no way to define the run loop or worker thread. But with an extra API, like: @propery (nonatomic) workerThread; // NOT part of AsynchronousOperation! or a suitable init method the run loop can be specified easily. Do I have to have a second variant, like runAsync:onQueue:, that does the same thing except it invokes the block on a queue? What actually is onQueue? The execution context where the actual code of the task shall run, or is it the execution context where the completion handler shall be executed? IMHO, a robust design should *not* require the call-site to specify the execution context of internal and private functions. Since internal functions are private the execution context shall, too! There may be valid but rare exceptions, though. The latter - that is the call-size specifies the execution context of the callback - is OK, though unnecessary. That’s messy, and if runloops had queues it would be unnecessary. Does anyone have any comments beyond “this isn’t supported, it's bad and you are clueless”?* I admit, it's a certain effort which is required when implementing a run loop based approach or when implementing a dispatch approach. A proper API then hides these implementation details. So, I think there is a solution for the client side, as shown above. You can go even further with an additional layer of abstraction, which - for the call-site - hides the implementation of, or kind of the asynchronous result provider, which can be a NSOperation or other class with delegates or completion handler, with either a run loop based approach or a dispatch approach, an asynchronous function, an asynchronous method, or whatever is suitable to asynchronously deliver the eventual result: The client side only deals with the eventual result represented in a Promise. e.g. Promise* promise = doSomethingAsyncWithParameter:(id)param; Here, the execution context where the task executes it's functions is not known to the call-site. (Think of a NSURLConnection). We didn't specify a completion handler, since this will be handled through the Promise in a much more elegant and more powerful way. Such a Promise is an Objective-C class, which encapsulates the eventual result (or
Keeping a number of Scroll in Sync
Hi, I've been asked to implement a View that contains three horizontal Scroll Views. Each scroll view contains a number of image views with a fixed height but variable width. There is a gap between each image in the a scroll view and a gap between each of the three Scroll views. The idea is that when one scroll view is scrolled by the user, the other two scroll with it but at a different rate. Think of the effect as looking like a wall made of different sized bricks: Top Scroll View:A BBB CC E Middle Scroll View: GG I J L Bottom Scroll View: MMM N OOO RRR Where , etc. are images in the Scroll Views. When the User scrolls the top view, the middle and bottom views should scroll too by a different amount. I've got this working but I'm not that happy with it, since it stutters and also I'm getting feedback because one Scroll View update another, which in turn updates the original scroll view. Basically, in the scrollViewDidScroll, I pass the contentOffset to the other two Scroll Views. I think that if I added some state info and did checking I could get it to work as required using this method, but I'm not sure that it is the best way to do it? All the Best Dave ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: How to get a Normal button in iOS 7/IB
Just my two cents - its not much work at all. Create a UIButton subclass. Have it use images or code - who cares. Then you just go and change the classes throughout code to your new subclass. For 5 apps, should take…30 minutes. Not supporting iOS 7? OK… On Fri, Oct 4, 2013 at 4:02 AM, Dave d...@looktowindward.com wrote: Hi, Using the cap approach sounds good, but it's way to much work for these 5 apps I have to modify. It's all a bit mute now anyway. since I've just come out of a meeting and, because of all this Button nonsense (as well as other UI issues) we are not going to support iOS 7 for these Apps for a while if ever. They work find on iOS 6 and the Users won't be upgrading their pads to iOS 7, so it really doesn't matter. I'm pleased because I was dreading having to change a *lot* of Button code just to get back what we already had a few days ago under iOS 6! Thanks a lot for everyone's time and at least I know how to do it now if we ever need to. All the Best Dave On 4 Oct 2013, at 00:52, Alex Zavatone z...@mac.com wrote: The cap approach is something that's supported with a standard button and it works really well. FWIW, I've been using it since 1998 with PNGs. Basically, the approach is that you have a PNG graphic that is nicely antialiased and alpha channeled. It consists of a button's left and right caps and a middle region that is a stretchable column of pixels. When making the button, and assigning the graphic, you define how many pixels are used in the left and right caps and the middle is taken from the middle column of pixels. Make sure to have a graphic that consists of the left, right and middle for each state of the button, such as active and clickable/tappable, active/over, down, selected, disabled. It works like a charm. I've even got some of these PNGs if you need to try it out on a UIButton. There are more advanced ways to make buttons with gradients by creating the image in code, but just creating a set of capped images for the button graphics is a pretty easy way to go. Lots of how some frameworks are implemented might not make sense and might suck to you. You'll find that the frameworks are how the frameworks are, like it or not. I'm sure that there are loads of custom button classes out there that you can find on Github or StackExchange that create buttons in code the way you expect. Whether something like this should be in the UIButton class or not, well - it probably should be, but it isn't and it's up to us to see how to deal with that. Might be a good little project for a class extension category for you to build out. On Oct 3, 2013, at 5:39 PM, Dave wrote: On 3 Oct 2013, at 21:13, Fritz Anderson fri...@manoverboard.org wrote: On 3 Oct 2013, at 2:09 PM, Dave d...@looktowindward.com wrote: Sorry, should have said, without using an Image. Why? Images are how this sort of thing gets done. Anything else is a stunt, unless you have some constraint you're not telling us about. (You're familiar with -[UIImage resizableImageWithCapInsets:] and related API?) I suppose (off the top of my head, not even written in Mail), you could have a UIButton subclass that returns a CALayer subclass of your devising from +layerClass, and have your layer set borders and corner-rounding. I really don't want to make lots of images just for this and to be honest, if a Framework doesn't support an Industry Standard Button out of the box, then, it sucks! Thanks Dave ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/zav%40mac.com This email sent to z...@mac.com ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/alex%40webis.net This email sent to a...@webis.net -- *Alex Kac - **President and Founder* *Web Information Solutions, Inc.* ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: How to get a Normal button in iOS 7/IB
On 4 Oct 2013, at 15:37, Alex Kac a...@webis.net wrote: Just my two cents - its not much work at all. Create a UIButton subclass. Have it use images or code - who cares. Then you just go and change the classes throughout code to your new subclass. For 5 apps, should take…30 minutes. There are a lot of buttons in each view and a lot of views, it would take me at least a day (probably two) to do this including testing. I'd have to locate and change each instance in the Storyboards/NIB. Then change the code to suit, it would be a horrible job, however, if you reckon you can do it in 30 minutes for all 5 apps, you're welcome to try! Shall I you send the projects? lol At £50 (say) per hour, that will be £25 I owe you, do you accept PayPal? £5 per App - a bargain! Not supporting iOS 7? OK… For until the new year at least thank the great coding god in the sky. All the Best Dave ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: How to get a Normal button in iOS 7/IB
Why not enumerate each subview, detect if it is a UIButton and add the capped images? -- :: marcelo.alves On 04/10/2013, at 11:37, Alex Kac a...@webis.net wrote: Just my two cents - its not much work at all. Create a UIButton subclass. Have it use images or code - who cares. Then you just go and change the classes throughout code to your new subclass. For 5 apps, should take…30 minutes. Not supporting iOS 7? OK… On Fri, Oct 4, 2013 at 4:02 AM, Dave d...@looktowindward.com wrote: Hi, Using the cap approach sounds good, but it's way to much work for these 5 apps I have to modify. It's all a bit mute now anyway. since I've just come out of a meeting and, because of all this Button nonsense (as well as other UI issues) we are not going to support iOS 7 for these Apps for a while if ever. They work find on iOS 6 and the Users won't be upgrading their pads to iOS 7, so it really doesn't matter. I'm pleased because I was dreading having to change a *lot* of Button code just to get back what we already had a few days ago under iOS 6! Thanks a lot for everyone's time and at least I know how to do it now if we ever need to. All the Best Dave On 4 Oct 2013, at 00:52, Alex Zavatone z...@mac.com wrote: The cap approach is something that's supported with a standard button and it works really well. FWIW, I've been using it since 1998 with PNGs. Basically, the approach is that you have a PNG graphic that is nicely antialiased and alpha channeled. It consists of a button's left and right caps and a middle region that is a stretchable column of pixels. When making the button, and assigning the graphic, you define how many pixels are used in the left and right caps and the middle is taken from the middle column of pixels. Make sure to have a graphic that consists of the left, right and middle for each state of the button, such as active and clickable/tappable, active/over, down, selected, disabled. It works like a charm. I've even got some of these PNGs if you need to try it out on a UIButton. There are more advanced ways to make buttons with gradients by creating the image in code, but just creating a set of capped images for the button graphics is a pretty easy way to go. Lots of how some frameworks are implemented might not make sense and might suck to you. You'll find that the frameworks are how the frameworks are, like it or not. I'm sure that there are loads of custom button classes out there that you can find on Github or StackExchange that create buttons in code the way you expect. Whether something like this should be in the UIButton class or not, well - it probably should be, but it isn't and it's up to us to see how to deal with that. Might be a good little project for a class extension category for you to build out. On Oct 3, 2013, at 5:39 PM, Dave wrote: On 3 Oct 2013, at 21:13, Fritz Anderson fri...@manoverboard.org wrote: On 3 Oct 2013, at 2:09 PM, Dave d...@looktowindward.com wrote: Sorry, should have said, without using an Image. Why? Images are how this sort of thing gets done. Anything else is a stunt, unless you have some constraint you're not telling us about. (You're familiar with -[UIImage resizableImageWithCapInsets:] and related API?) I suppose (off the top of my head, not even written in Mail), you could have a UIButton subclass that returns a CALayer subclass of your devising from +layerClass, and have your layer set borders and corner-rounding. I really don't want to make lots of images just for this and to be honest, if a Framework doesn't support an Industry Standard Button out of the box, then, it sucks! Thanks Dave ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/zav%40mac.com This email sent to z...@mac.com ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/alex%40webis.net This email sent to a...@webis.net -- *Alex Kac - **President and Founder* *Web Information Solutions, Inc.* ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/marcelo.alves%40me.com This email sent to marcelo.al...@me.com
C++ Function Call from Obj-C
I have a stack variable in an Obj-C Interface which is a C++ Class. I call a function of this class. If I run the app from XCode it works as expected, i.e. the function is called. But, if I run the app from the Finder the function is not called. What am I missing or should I say How can this be? -koko ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
why isn't idMyCellDelegate an id?
Here's a familiar pattern, a .h file defining a protocol and a delegate that must adopt it: @protocol MyCellDelegate; @interface MyCell : UITableViewCell @property (nonatomic, weak) idMyCellDelegate celldelegate; @end @protocol MyCellDelegate @end Here's the mystery. In the corresponding .m file: -(BOOL)test { return [self.celldelegate respondsToSelector:@selector(foo:)]; // ...wait for it... } Compile error! No known instance method for selector 'respondsToSelector:'. WTF??? Here are two ways of fixing the problem. (1) Cast to id: -(BOOL)test { return [(id)self.celldelegate respondsToSelector:@selector(foo:)]; } Or, (2) inherit NSObject protocol back in the protocol definition: @protocol MyCellDelegateNSObject @end But why is either of those necessary? Surely an idMyCellDelegate is, by definition, an id - which inherits from NSObject, and thus should solve the problem, just like casting to id. It is as if idMyCellDelegate is not an id, which makes no sense to me. Is this a Clang bug? Or am I just missing some fundamental truth? m. -- matt neuburg, phd = m...@tidbits.com, http://www.apeth.net/matt/ pantes anthropoi tou eidenai oregontai phusei Programming iOS 7! http://shop.oreilly.com/product/0636920031017.do iOS 7 Fundamentals! http://shop.oreilly.com/product/0636920032465.do RubyFrontier! http://www.apeth.com/RubyFrontierDocs/default.html TidBITS, Mac news and reviews since 1990, http://www.tidbits.com ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Doc Viewer in 5.0.1
Is it just me or did the finally-good-in-5 doc viewer get tweaked for the worse in 5.0.1 ? Where did the right sidebar go? That was great… :( This popover business when clicking on More related items…” stinks. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: How to get a Normal button in iOS 7/IB
On 4 Oct 2013, at 10:54 AM, Marcelo Alves marcelo.al...@me.com wrote: Why not enumerate each subview, detect if it is a UIButton and add the capped images? Easier: Select each button and connect it to an outlet collection @property (strong, nonatomic) IBOutletCollection(UIButton) NSArray *customButtons; and enumerate .customButtons. Interface Builder will create a collection outlet if you select that type in the normal control-drag process. And now someone will tell me that despite my simple experiments, outlet collections never really worked. — F ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: NSControl subclass is not becoming initial first responder without Full Keyboard Access
No ideas on this? We have an NSControl subclass in a window. The class returns YES from acceptsFirstResponder and canBecomeKeyView, and it overrides some NSResponder methods (mouseDown:, keyDown:). The control is set to be the initialFirstResponder in the xib. Yet it will not be the initial first responder unless Full Keyboard Access is turned on. Even if FKA is off I can still tab to it and it gains focus. What else should I be doing here? If I override makeFirstResponder: in our window subclass, I see that an NSTextField is being set as the first responder when we tell the window to orderFront. The stack: #0 0x0144b8d3 in -[EDLGWindow makeFirstResponder:] at /depot/Finale_Main/FinaleDev/Finale/SRC/FIN/MAC/Cocoa/EDLGController.mm:172 #1 0x90c8053c in -[NSWindow _selectFirstKeyView] () #2 0x90c801fe in -[NSWindow _setUpFirstResponder] () #3 0x90c8014e in -[NSWindow _setUpFirstResponderBeforeBecomingVisible] () #4 0x90c7e5c9 in -[NSWindow _reallyDoOrderWindow:relativeTo:findKey:forCounter:force:isModal:] () #5 0x90c7e0b6 in -[NSWindow _doOrderWindowWithoutAnimation:relativeTo:findKey:forCounter:force:isModal:] () #6 0x90c7dbcd in -[NSWindow _doOrderWindow:relativeTo:findKey:forCounter:force:isModal:] () #7 0x90c7d734 in -[NSWindow orderWindow:relativeTo:] () #8 0x90b581d8 in -[NSWindow orderFront:] () Why is it choosing a text field instead of the control that I explicitly set as the initialFirstResponder in the xib? -- Steve Mills office: 952-818-3871 home: 952-401-6255 cell: 612-803-6157 ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: C++ Function Call from Obj-C
On 4 Oct 2013, at 11:27 AM, koko k...@highrolls.net wrote: I have a stack variable in an Obj-C Interface which is a C++ Class. I call a function of this class. If I run the app from XCode it works as expected, i.e. the function is called. But, if I run the app from the Finder the function is not called. What am I missing or should I say How can this be? From your description, there is absolutely no way of knowing. There could be any number of conditions in the stack above the call site that only you know about. Try running the application from the Finder, modified if necessary to loop before getting to the call site, and attach command-line lldb (or even the Xcode debugger) to it. The canonical reason a Mac application behaves differently in Xcode and in real life is that you're depending on the working directory Xcode gives you. Last I looked, it was the application directory under Xcode, and / from the Finder. (Xcode. Lower-case c.) — F ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: why isn't idMyCellDelegate an id?
On Oct 4, 2013, at 9:59 AM, Matt Neuburg m...@tidbits.com wrote: Or, (2) inherit NSObject protocol back in the protocol definition: @protocol MyCellDelegateNSObject @end You should do this. But why is either of those necessary? Surely an idMyCellDelegate is, by definition, an id idMyCellDelegate is more specific than id, and so the compiler warns about calling methods that are not declared in MyCellDelegate. - which inherits from NSObject id does not inherit from NSObject, it is just a generic object pointer. In many ways its a “get out of the type system free” card. But if you add type information to id by restricting it via a protocol, then you are requesting type checking. , and thus should solve the problem, just like casting to id. It is as if idMyCellDelegate is not an id, which makes no sense to me. Is this a Clang bug? Or am I just missing some fundamental truth? -- David Duncan ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: why isn't idMyCellDelegate an id?
On Oct 4, 2013, at 9:59 AM, Matt Neuburg m...@tidbits.com wrote: But why is either of those necessary? Surely an idMyCellDelegate is, by definition, an id Nope. A couple years back the type of idSomeProtocol was changed to only respond to the methods in the protocol. This is arguably much more useful, since otherwise the difference between id and idProtocol is so minute to almost not exist. The recommended practice is to make your protocols derive from NSObject, which is now part of Xcode’s autocompletion template for @protocol. --Kyle Sluder ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: why isn't idMyCellDelegate an id?
On Fri, 4 Oct 2013 09:59:53 -0700, Matt Neuburg said: -(BOOL)test { return [self.celldelegate respond sToSelector:@selector(foo:)]; // ...wait for it... } Compile error! No known instance method for selector 'respondsToSelector:'. WTF??? Here are two ways of fixing the problem. (1) Cast to id: -(BOOL)test { return [(id)self.celldelegate respondsToSelector:@selector(foo:)]; } Or, (2) inherit NSObject protocol back in the protocol definition: @protocol MyCellDelegateNSObject @end That's the correct solution. But why is either of those necessary? Surely an idMyCellDelegate is, by definition, an id - which inherits from NSObject, You've got that backwards. NSObject 'inherits' from id. respondsToSelector: is part of the NSObject (and NSProxy) protocol. Objects that aren't subclasses of NSObject might not respond to it. Cheers, -- Sean McBride, B. Eng s...@rogue-research.com Rogue Researchwww.rogue-research.com Mac Software Developer Montréal, Québec, Canada ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Doc Viewer in 5.0.1
Xcode 5.0.1 is prerelease software covered under NDA. If you would like to discuss prerelease software, use the Developer Forums: http://devforums.apple.com. If you would like to submit feedback on prerelease software, use Bug Reporter: http://bugreport.apple.com. --Kyle Sluder On Oct 4, 2013, at 10:12 AM, dangerwillrobinsondan...@gmail.com wrote: Is it just me or did the finally-good-in-5 doc viewer get tweaked for the worse in 5.0.1 ? Where did the right sidebar go? That was great… :( This popover business when clicking on More related items…” stinks. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: NSControl subclass is not becoming initial first responder without Full Keyboard Access
On Oct 4, 2013, at 10:17 AM, Steve Mills smi...@makemusic.com wrote: No ideas on this? Guess not. Given the volume and specificity of your questions, and the apparent speed with which you expect answers from this volunteer community, have you considered purchasing a DTS incident? Unlike this mailing list, DTS incidents come with a guaranteed response. --Kyle Sluder ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Doc Viewer in 5.0.1
On 4 Oct 2013, at 12:12 PM, dangerwillrobinsondan...@gmail.com wrote: Is it just me or did the finally-good-in-5 doc viewer get tweaked for the worse in 5.0.1 ? Where did the right sidebar go? That was great… :( ? It's been rearranged, but it's all still there. Make sure the two buttons between back/forward and the search field are highlighted, and you get, on the left, a column containing the full documentation library (Sigh. I never found it useful, but having a top level is probably a checkoff.) or your bookmark list (as before). (Oh… there's an Editor Reveal in Library command that selects the current article in the outline, thus making it possible to find sister articles. I unsay my remark on its usefulness. Much less annoying than the old jump bar.) The second column is the outline of the current document (as was in the old column on the right). The class summary that had been an option in the old right column is now stuck above the document scroll view. I think it's a good move to keep both visible. This popover business when clicking on More related items…” stinks. Maybe I haven't found a popover yet, except for what appears when you click the magnifying-class badge. Do you mean the last item in the dropdown from the search field, now called Show all results? I've filed bugs on it. The problem is that the Return key means different things depending on a not-easily-discerned context. Once you make a choice from that dropdown, there's no way to recover it. You're left to fiddle with add-then-delete an extra character, or reselecting the search field, hitting Return one more time, and dealing with the much-longer page of hits. I like that page, but I find it tricky to get to. — F ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Doc Viewer in 5.0.1
On 4 Oct 2013, at 12:28 PM, Kyle Sluder k...@ksluder.com wrote: Xcode 5.0.1 is prerelease software covered under NDA. You are correct, and I apologize for responding in this thread. — F ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: NSControl subclass is not becoming initial first responder without Full Keyboard Access
On Oct 4, 2013, at 12:30:51, Kyle Sluder k...@ksluder.com wrote: Given the volume and specificity of your questions, and the apparent speed with which you expect answers from this volunteer community, have you considered purchasing a DTS incident? Unlike this mailing list, DTS incidents come with a guaranteed response. I don't *expect* quick answers, but since there's no way of knowing how many people have looked at my question, and given the volume of other messages that have come through recently, I was simply asking again in case my previous message was missed, or in case any people who might know the answer simply didn't have time to read messages from this list yesterday. I'm full aware of what a DTS incident is. No need to be condescending. Also, most Apple mailing list responses come *much* quicker than DTS responses, in my 18-year experience as an Apple developer. -- Steve Mills office: 952-818-3871 home: 952-401-6255 cell: 612-803-6157 ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Can I create a thread with a runloop and a dispatch queue?
On Oct 4, 2013, at 4:08 AM, Andreas Grosam agro...@onlinehome.de wrote: Scheduling or dispatching a callback or block onto a known thread/queue will increase the risk for a dead lock. Thus, the execution context of the callback shall be created/selected by the asynchronous result provider and should not be accessible by the call-site. It seems the other way around to me. If (as I suggested) the implementation schedules the callback on a caller-selected queue, it’s asynchronous and the worker queue keeps going. But, if the implementation calls the callback directly from its internal worker queue, it’s now at the mercy of the caller — it has no idea how long that block will take to execute, and the internal worker queue can’t handle any more requests until the caller’s block returns. In the worst case, the caller’s block could try to execute another request synchronously and that _would_ deadlock: [foo doSomethingAndThen: ^{ x = [foo doSomethingElseAndReturnResultSynchronously]; }]; If the block above is called on foo’s worker queue, this code will deadlock because the queue will never be able to process the ‘doSomethingElse’ request. Basically, by calling a client-supplied block on its private internal queue, the implementation is exposing sensitive internal state to its callers. That seems like a really bad idea. —Jens ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Doc Viewer in 5.0.1
It's also worth mentioning that the Xcode Developer Forums are now open to all developers with a registered account, paid or free. The Mac and iPhone forums are still restricted to paying members of those programs. On Fri, Oct 4, 2013, at 10:28 AM, Kyle Sluder wrote: Xcode 5.0.1 is prerelease software covered under NDA. If you would like to discuss prerelease software, use the Developer Forums: http://devforums.apple.com. If you would like to submit feedback on prerelease software, use Bug Reporter: http://bugreport.apple.com. --Kyle Sluder On Oct 4, 2013, at 10:12 AM, dangerwillrobinsondan...@gmail.com wrote: Is it just me or did the finally-good-in-5 doc viewer get tweaked for the worse in 5.0.1 ? Where did the right sidebar go? That was great… :( This popover business when clicking on More related items…” stinks. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: To find if a binary is being used/running
On Oct 4, 2013, at 12:08 AM, Nick Rogers roger...@mac.com wrote: Is this even possible? Basically no. In Unix there is no connection from an executable file to a process running that file (or from _any_ file to a process that has that file open, really.) The most exhaustive solution is what the `lsof` and `ps` tools do, basically iterating over the kernel’s list of open files and running processes and looking for a match, which is expensive. Unix tools often seem to use a strategy of creating a ‘pid’ file at some known location, which contains the process ID of the running instance of the tool. The tool has to write the file when it starts up, and be careful to delete it whenever it exits (including if it crashes or is killed.) But I agree with Kyle, you should be using XPC or something similar to manage helper tasks. —Jens ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: why isn't idMyCellDelegate an id?
On Oct 4, 2013, at 9:59 AM, Matt Neuburg m...@tidbits.com wrote: But why is either of those necessary? Surely an idMyCellDelegate is, by definition, an id - which inherits from NSObject ‘id’ is not a type that inherits from NSObject. ‘id’ is explicitly untyped. ‘idMyCellDelegate’ is _not_ untyped — its type is ‘any class that implements MyCellDelegate'. And unless that protocol inherits from the NSObject protocol, it does not include the -respondsToSelector: method. This may seem inconsistent, but if ‘idSomeProtocol’ were really untyped, then you’d lose all type-checking for calls to it, so you could make typos like [cellDelegate f:] without any compile-time error. —Jens ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Can I create a thread with a runloop and a dispatch queue?
On Fri, Oct 4, 2013, at 10:16 AM, Jens Alfke wrote: Basically, by calling a client-supplied block on its private internal queue, the implementation is exposing sensitive internal state to its callers. That seems like a really bad idea. This jibes with my memory of Andy's argument, which I'm afraid is lost to the annals of Twitter history. However, there's a very cogent thread on GitHub about a the relative (un)safety of letting queues escape your control, in the context of dispatch_get_current_queue() and queue targeting: //github.com/jspahrsummers/SafeDispatch/issues/1 --Kyle Sluder ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: why isn't idMyCellDelegate an id?
On 4 Oct 2013, at 10:53, Jens Alfke j...@mooseyard.com wrote: On Oct 4, 2013, at 9:59 AM, Matt Neuburg m...@tidbits.com wrote: But why is either of those necessary? Surely an idMyCellDelegate is, by definition, an id - which inherits from NSObject ‘id’ is not a type that inherits from NSObject. ‘id’ is explicitly untyped. ‘idMyCellDelegate’ is _not_ untyped — its type is ‘any class that implements MyCellDelegate'. And unless that protocol inherits from the NSObject protocol, it does not include the -respondsToSelector: method. This may seem inconsistent, but if ‘idSomeProtocol’ were really untyped, then you’d lose all type-checking for calls to it, so you could make typos like [cellDelegate f:] without any compile-time error. Right, really the confusion stems from the fact that objective-c has a strange behaviour when dealing with the type “id”. To objective-c “id” means “any object”, and the compiler takes that to mean “I don’t know what it is, so I’m going to assume this all-powerful human knows what they’re doing, and allow them to call any method at all on it.” The more mathematically correct thing to do (and what it does for all other types) is “I don’t know what it is, so I can’t ‘prove’* anything at all about whether this is correct, therefore it’s not correct. Puny human, you must provide me with more information to make proofs”. Unfortunately, thanks to obj-c’s lack of parametric polymorphism, the “I have no clue what this thing is” situation comes up an awful lot, and it becomes decidedly inconvenient to have that second, more correct behaviour, so I guess someone made a pragmatic decision to effectively disable all checking when ids come up. My recommendation would be to file a radar about this, along with the fact that ids come up all the time, and show some support for wanting a language where the compiler can make more proofs for us. Thanks Tom Davie * prove is a loaded term when it comes to objective-c, as the runtime can mess up your compile time proof by dynamically switching things about under your feet. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
How to get variably sized header in a UICollectionView supporting both orientations
Becoming increasingly adept at autolayout but currently stumped. What I am trying to do is design a UICollectionView header that using constraints is suitable for portrait and landscape. I have a bunch of views in it, each grouped into a container view. What I'd like to do is when the view rotates, move the container views around. Currently this seems impossible because the size of the header (and footer) must be specified to the Flow Layout before the view is even created, and it appears to be fixed from them on. As it stands now, what I'm doing is creating the header in code, and using knowledge of what orientation the view will be shown in, and varying the constraints on the container views. By reloading the collection view on every rotation, I can get a new (and properly) sized header. This seems like driving a nail with a sledgehammer, but nothing else comes to mind. Very open to suggestions on better methods. David ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: How to get variably sized header in a UICollectionView supporting both orientations
On Oct 4, 2013, at 11:35 AM, David Hoerl dho...@mac.com wrote: Becoming increasingly adept at autolayout but currently stumped. What I am trying to do is design a UICollectionView header that using constraints is suitable for portrait and landscape. I have a bunch of views in it, each grouped into a container view. What I'd like to do is when the view rotates, move the container views around. Currently this seems impossible because the size of the header (and footer) must be specified to the Flow Layout before the view is even created, and it appears to be fixed from them on. Do you mean the header/footerReferenceSize properties? If so I would think this would just work, since the flow layout will automatically size the width or height (depending on the scrolling direction) to fill the width or height of the collection view, allowing your container to just specify its sizes relative to the parent view size without needing to know the orientation. But maybe I just don’t understand exactly what you are running up against? As it stands now, what I'm doing is creating the header in code, and using knowledge of what orientation the view will be shown in, and varying the constraints on the container views. By reloading the collection view on every rotation, I can get a new (and properly) sized header. This seems like driving a nail with a sledgehammer, but nothing else comes to mind. Very open to suggestions on better methods. David ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/david.duncan%40apple.com This email sent to david.dun...@apple.com -- David Duncan ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: How to get a Normal button in iOS 7/IB
On 4 Oct 2013, at 18:14, Fritz Anderson fri...@manoverboard.org wrote: On 4 Oct 2013, at 10:54 AM, Marcelo Alves marcelo.al...@me.com wrote: Why not enumerate each subview, detect if it is a UIButton and add the capped images? Easier: Select each button and connect it to an outlet collection @property (strong, nonatomic) IBOutletCollection(UIButton) NSArray *customButtons; and enumerate .customButtons. Interface Builder will create a collection outlet if you select that type in the normal control-drag process. And now someone will tell me that despite my simple experiments, outlet collections never really worked. Well. there seems like a lot of different ways to do this, thanks a lot. I had hoped for a solution where I could just change the Storyboard/NIB but it doesn't look like that is possible, but, as I said it doesn't matter for at least three months, since they have decided to stick with iOS 6 for the time being. Which is fine by me because there is a lot of way more interesting things to do instead. All the Best Dave ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: why isn't idMyCellDelegate an id?
On Oct 4, 2013, at 9:59 AM, Matt Neuburg m...@tidbits.com wrote: Surely an idMyCellDelegate is, by definition, an id It is not. There is no id-style type system leniency in `idSomeProtocol`. That type must conform to the protocol and respond to its methods, and nothing more. Unlike `id` it does not allow use of any other methods. In practice you'll usually want to use NSObjectSomeProtocol*, in part because there are useful methods in class NSObject that are not part of protocol NSObject. -- Greg Parker gpar...@apple.com Runtime Wrangler ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Autolayout fixed size centering in VFL
I have a fixed size custom OS X view that I load from a nib and want to centre within a host view using auto layout. Can this be done using VFL alone? My best shot at it follows, but it is incorrect: [self.window.contentView addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@|-(=0)-[subview(width)]-(=0)-| options:NSLayoutFormatAlignAllCenterY metrics:@{@width: @(width)} views:@{@subview: self.subview}]]; [self.window.contentView addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@V:|-(=0)-[subview(height)]-(=0)-| options:NSLayoutFormatAlignAllCenterX metrics:@{@height: @(height)} views:@{@subview: self.subview}]]; To achieve the desired effect: a: The subview needs to acquire separate width and height constraints that reference itself. b: The contentView needs to acquire constraints that center the subview within it. The autolayout docs say: The notation prefers good visualization over completeness of expressibility. There are constraints that cannot be expressed in visual format syntax, although most of the constraints that are useful in real user interfaces can be. I would have intuitively thought that this was doable. Others (http://stackoverflow.com/questions/12873372/centering-a-view-in-its-superview-using-visual-format-language) seem divided on the question. I personally cannot get a VFL only solution to work on OS X. Notes: 1. I can achieve it simply in IB. 2. I can achieve it using explicit constraints like so: - (void)addCenteredSubview:(NSView *)subview { // if translatesAutoresizingMaskIntoConstraints = YES then constraints will be automatically added // when the view is added to a supview. we require to constrain manually set make sure the // translation is off. subview.translatesAutoresizingMaskIntoConstraints = NO; // with the above off we will need to apply width + height contstraints CGFloat width = subview.frame.size.width; CGFloat height = subview.frame.size.height; // add width and height constraints to the subview [subview addConstraint:[NSLayoutConstraint constraintWithItem:subview attribute:NSLayoutAttributeWidth relatedBy:NSLayoutRelationEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1.0 constant:width]]; [subview addConstraint:[NSLayoutConstraint constraintWithItem:subview attribute:NSLayoutAttributeHeight relatedBy:NSLayoutRelationEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1.0 constant:height]]; // the subview needs to be part of the view hierarchy before constraints // can be applied that relate the superview and the subview [self addSubview:subview]; [self addConstraint:[NSLayoutConstraint constraintWithItem:subview attribute:NSLayoutAttributeCenterX relatedBy:NSLayoutRelationEqual toItem:self attribute:NSLayoutAttributeCenterX multiplier:1.0 constant:0]]; [self addConstraint:[NSLayoutConstraint constraintWithItem:subview attribute:NSLayoutAttributeCenterY relatedBy:NSLayoutRelationEqual toItem:self attribute:NSLayoutAttributeCenterY multiplier:1.0 constant:0]]; } ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This
Re: Autolayout fixed size centering in VFL
On Fri, Oct 4, 2013, at 01:31 PM, jonat...@mugginsoft.com wrote: I have a fixed size custom OS X view that I load from a nib and want to centre within a host view using auto layout. Can this be done using VFL alone? No. But it's still really simple to do in code. To achieve the desired effect: a: The subview needs to acquire separate width and height constraints that reference itself. The width and height of the view are independent of its position. Correctly specifying the view's size is a separate issue. Typically that is done by virtue of the constraints installed _within_ the view. I personally cannot get a VFL only solution to work on OS X. Correct; you will not be able to. Notes: 1. I can achieve it simply in IB. Yup. 2. I can achieve it using explicit constraints like so: - (void)addCenteredSubview:(NSView *)subview { // if translatesAutoresizingMaskIntoConstraints = YES then constraints will be automatically added // when the view is added to a supview. we require to constrain manually set make sure the // translation is off. subview.translatesAutoresizingMaskIntoConstraints = NO; // with the above off we will need to apply width + height contstraints CGFloat width = subview.frame.size.width; CGFloat height = subview.frame.size.height; Again, why are you concerning yourself with the view's size here? It is not necessary to explicitly specify a size in order to get centering behavior. --Kyle Sluder ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: How to get variably sized header in a UICollectionView supporting both orientations
I have a bunch of views in it, each grouped into a container view. What I'd like to do is when the view rotates, move the container views around. Currently this seems impossible because the size of the header (and footer) must be specified to the Flow Layout before the view is even created, and it appears to be fixed from them on. Do you mean the header/footerReferenceSize properties? No If so I would think this would just work, since the flow layout will automatically size the width or height (depending on the scrolling direction) to fill the width or height of the collection view, allowing your container to just specify its sizes relative to the parent view size without needing to know the orientation. But maybe I just don’t understand exactly what you are running up against? I have two sections, so have to use the Flow Delegate callback to supply the sizes: - (CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout*)collectionViewLayout referenceSizeForHeaderInSection:(NSInteger)section The Flow Layout object asks for the sizes first, then the header (or footer if used). I tried returning one size in the above delegate method, then a larger header, but the collection view does not appear to look at the view's size, instead honoring the delegate returned value. Hmmm - it looks like I overlooked sending the layout object invalidateLayout. I just did that in the willAnimate... rotation view controller method, and I observe the layout object asked again the the header height. But its really odd - and I'm thinking about a bug report on this - that the delegate has to provide the size before the view is even created. So what I do now is create a header view in view did load, ask it for its size using systemLayoutSizeFittingSize, then release it, just to get the size (its using the new dynamic text so this is the only way to get its size). Later, Flow Layout asks for the size, then in another delegate call I dequeue a header view whose size I now know. I tried to cache the first view but that failed. -- David Duncan ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
performKeyEquivalent is finding the wrong menu item
We have a menu that has one submenu with an item that uses unmodified 7, then another submenu with an item that uses control-7. When control-7 is typed, Cocoa is finding the item with unmodified 7 instead of the item with control-7. If I trap this event in our app's sendEvent: method and make a new event withOUT the device-dependant flags in the modifiers, then it works correctly: newEvent = [NSEvent keyEventWithType:NSKeyDown location:event.locationInWindow modifierFlags:event.modifierFlags NSDeviceIndependentModifierFlagsMask timestamp:event.timestamp windowNumber:event.windowNumber context:event.context characters:event.characters charactersIgnoringModifiers:event.charactersIgnoringModifiers isARepeat:event.isARepeat keyCode:event.keyCode]; [super sendEvent:newEvent]; The modifiers for the event we get from the OS is 0x00040101. Is this just a bug in NSMenu's key equiv matching algorithm? If I set the lower submenu's item to use control-a, and a higher submenu's item already handles unmodified a, then it works correctly and control-a goes to the lower item. So there's something weird with number keys. I'm not using numpad keys in any part of this particular problem. -- Steve Mills office: 952-818-3871 home: 952-401-6255 cell: 612-803-6157 ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Autolayout fixed size centering in VFL
On Fri, Oct 4, 2013, at 01:52 PM, Kyle Sluder wrote: The width and height of the view are independent of its position. Correctly specifying the view's size is a separate issue. Typically that is done by virtue of the constraints installed _within_ the view. (In other words, split up the centering constraints from the fixed-size constraints.) --Kyle Sluder ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: why isn't idMyCellDelegate an id?
On Oct 4, 2013, at 20:30 , Tom Davie tom.da...@gmail.com wrote: Right, really the confusion stems from the fact that objective-c has a strange behaviour when dealing with the type “id”. Actually, “id” is not “strange” at all. It just uses the very simple Smalltalk semantics: an object *always* responds to a message-send. One of those responses is to invoke the method “doesNotUnderstand:” or “forwardInvocation:” in Objective-C. At some point, Objective-C added *optional* static typing. The more mathematically correct thing to do... It ain’t more correct, mathematically or otherwise... (and what it does for all other types) is “I don’t know what it is, so I can’t ‘prove’* anything at all about whether this is correct, therefore it’s not correct. Puny human, you must provide me with more information to make proofs”. …and there ain’t no proofs either. My recommendation would be to file a radar about this, along with the fact that ids come up all the time, and show some support for wanting a language where the compiler can make more proofs for us. Actually, the semantics have all the proof you need. If you want different semantics, there are PLENTY of languages that work the way you’d like, why don’t you use one of those? Just sayin' Marcel ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: How to get variably sized header in a UICollectionView supporting both orientations
On Oct 4, 2013, at 1:52 PM, David Hoerl dho...@mac.com wrote: But its really odd - and I'm thinking about a bug report on this - that the delegate has to provide the size before the view is even created. It make sense if you think about it: it's asking for sizes so that scroll view contentSize can be set and the layout can be determined. It would be a lot more expensive to have to actually build each of the cells for the entire collection just to get their sizes. This sort of behavior also happens with UITableView and its various cells. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: why isn't idMyCellDelegate an id?
On Oct 4, 2013, at 11:30 AM, Tom Davie tom.da...@gmail.com wrote: The more mathematically correct thing to do (and what it does for all other types) is “I don’t know what it is, so I can’t ‘prove’* anything at all about whether this is correct, therefore it’s not correct. Puny human, you must provide me with more information to make proofs”. It’s only mathematically correct if you are talking about a strong type system as in C++/Java/Haskell/etc. But Objective-C has a mixture of strong and dynamic typing, and in fact the dynamic typing is older: in the original Objective-C language the only object reference type was ‘id’, and typed object pointers were added later. IMHO the mixture of static and dynamic typing is very useful; most of the time you get good compile-time checking, and the exceptions to that are to avoid the kind of rat-holing into parameterized types that adds so much complexity to C++. (Or if you want to think about it in non-OOP terms, ‘id’ is the Obj-C equivalent of C’s ‘void*’, but not C++’s ‘void*’.) tl;dr: Both static and dynamic typing are valid language designs, and both are extremely popular. One is not more “correct” than the other. —Jens ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: How to get variably sized header in a UICollectionView supporting both orientations
On 10/4/13 5:09 PM, Steve Christensen wrote: On Oct 4, 2013, at 1:52 PM, David Hoerl dho...@mac.com wrote: But its really odd - and I'm thinking about a bug report on this - that the delegate has to provide the size before the view is even created. It make sense if you think about it: it's asking for sizes so that scroll view contentSize can be set and the layout can be determined. It would be a lot more expensive to have to actually build each of the cells for the entire collection just to get their sizes. This sort of behavior also happens with UITableView and its various cells. In the old days, you had static views. Now with dynamic type, and the ability to more easily support different dynamic portrait/landscape layouts (with autolayout), the views can change a lot. Also, for table headers and footers, you created the view then set or returned it. With Collections you have to dequeue it, and ostensibly you can only do this when asked for a cell (since there is no way I know to dequeue a view then tell the collection that you don't really need it after all). Maybe I could dequeue one early on, cache it to get the sizes, and the first time only I'm asked for the view, return the cached one (then nil out the reference). This seems like it might work but IMHO would be risky in terms of stretching the API. I will probably at least try that out when I get everything else working. David ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Doc Viewer in 5.0.1
Egads. Forgot. Fooled by the tiny version number and annoyance. Apologies. Sent from my iPhone On 2013/10/05, at 2:28, Kyle Sluder k...@ksluder.com wrote: Xcode 5.0.1 is prerelease software covered under NDA. If you would like to discuss prerelease software, use the Developer Forums: http://devforums.apple.com. If you would like to submit feedback on prerelease software, use Bug Reporter: http://bugreport.apple.com. --Kyle Sluder On Oct 4, 2013, at 10:12 AM, dangerwillrobinsondan...@gmail.com wrote: Is it just me or did the finally-good-in-5 doc viewer get tweaked for the worse in 5.0.1 ? Where did the right sidebar go? That was great… :( This popover business when clicking on More related items…” stinks. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: C++ Function Call from Obj-C
You set me on the right path … I ran the app from the Finder and attached to it from Xcode … The problem … running from Xcode the destination was 32 bit running from Finder we run in 64 bit a supporting library containing the call in question would not operate correctly in 64 bit thx … -koko On Oct 4, 2013, at 11:20 AM, Fritz Anderson fri...@manoverboard.org wrote: On 4 Oct 2013, at 11:27 AM, koko k...@highrolls.net wrote: I have a stack variable in an Obj-C Interface which is a C++ Class. I call a function of this class. If I run the app from XCode it works as expected, i.e. the function is called. But, if I run the app from the Finder the function is not called. What am I missing or should I say How can this be? From your description, there is absolutely no way of knowing. There could be any number of conditions in the stack above the call site that only you know about. Try running the application from the Finder, modified if necessary to loop before getting to the call site, and attach command-line lldb (or even the Xcode debugger) to it. The canonical reason a Mac application behaves differently in Xcode and in real life is that you're depending on the working directory Xcode gives you. Last I looked, it was the application directory under Xcode, and / from the Finder. (Xcode. Lower-case c.) — F ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Autolayout fixed size centering in VFL
On 4 Oct 2013, at 21:52, Kyle Sluder k...@ksluder.com wrote: On Fri, Oct 4, 2013, at 01:31 PM, jonat...@mugginsoft.com wrote: I have a fixed size custom OS X view that I load from a nib and want to centre within a host view using auto layout. Can this be done using VFL alone? No. Thanks for the confirmation. But it's still really simple to do in code. Simple and verbose. The VFL would be more concise. In reality I am just trying to figure out auto layout. Again, why are you concerning yourself with the view's size here? It is not necessary to explicitly specify a size in order to get centering behavior. I do see it as a necessity, given the approach listed. If a view provides intrinsic size info then explicit size constrains will not be required. A raw NSView instance requires the width/attributes to display correctly as far as my experiments have confirmed. This agrees with dumping layout constraints added in IB. In the following case auto layout fails because there are no size constraints. self.customview.translatesAutoresizingMaskIntoConstraints = NO; // we don't want any auto constraints applied [self.window.contentView addSubview: self.customview]; // recreate the fixed size centering constraints explictly /* [self.customview addConstraint:[NSLayoutConstraint constraintWithItem:self.customview attribute:NSLayoutAttributeWidth relatedBy:NSLayoutRelationEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1.0 constant:width]]; [self.customview addConstraint:[NSLayoutConstraint constraintWithItem:self.customview attribute:NSLayoutAttributeHeight relatedBy:NSLayoutRelationEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1.0 constant:height]]; */ [self.window.contentView addConstraint:[NSLayoutConstraint constraintWithItem:self.customview attribute:NSLayoutAttributeCenterX relatedBy:NSLayoutRelationEqual toItem:self.window.contentView attribute:NSLayoutAttributeCenterX multiplier:1.0 constant:0]]; [self.window.contentView addConstraint:[NSLayoutConstraint constraintWithItem:self.customview attribute:NSLayoutAttributeCenterY relatedBy:NSLayoutRelationEqual toItem:self.window.contentView attribute:NSLayoutAttributeCenterY multiplier:1.0 constant:0]]; Jonathan ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Migrating Core Data models
I changed the type of a property from NSString to Transformable. I added a new model version to do this, and set the appropriate flags. But Core Data seems to be deleting my database and starting fresh, anyway. I verified that if I don't set the auto-migration options, then it gets an error when it attempts to open the db. Any idea how I can figure out what's going wrong here? If I have to write custom migration code, that's fine. The property in question was unused until now, so the data in that property can be discarded (it should be null for all records). But it's blowing away all the data. Thanks, -- Rick signature.asc Description: Message signed with OpenPGP using GPGMail ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: why isn't idMyCellDelegate an id?
On Oct 4, 2013, at 12:50 PM, Greg Parker gpar...@apple.com wrote: In practice you'll usually want to use NSObjectSomeProtocol* Well *there* is a solution I would never have thought of in a million years. I'm a bit surprised that so many built-in delegate properties in iOS (like, all of them, many dozens) are typed as idSomeProtocol rather than demonstrating this approach. Nor have I ever seen it in any of Apple's own example code. A good place for Apple to start would be the Utility Application template, which uses this .h file code: @class FlipsideViewController; @protocol FlipsideViewControllerDelegate // ... @end @interface FlipsideViewController : UIViewController @property (weak, nonatomic) id FlipsideViewControllerDelegate delegate; // ... @end This uses (and teaches) none of the yummy goodness of either making the protocol adopt NSObject or of making the delegate an NSObject*. As usual, thanks to all who answered; I learned a lot. m. -- matt neuburg, phd = m...@tidbits.com, http://www.apeth.net/matt/ pantes anthropoi tou eidenai oregontai phusei Programming iOS 7! http://shop.oreilly.com/product/0636920031017.do iOS 7 Fundamentals! http://shop.oreilly.com/product/0636920032465.do RubyFrontier! http://www.apeth.com/RubyFrontierDocs/default.html TidBITS, Mac news and reviews since 1990, http://www.tidbits.com ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Autolayout fixed size centering in VFL
First of all ... very much appreciate you both so often! Thanks for commenting as much as you do. I too faced this issue and, like Kyle, read enough to assume it was generally not possible with VFL. But this afternoon, I came across this: https://github.com/evgenyneu/center-vfl and for my specific case, it works perfectly. Let me know what you think ... and if you see caveats. I'm successfully using this technique to center an ImageView populated with an image much larger than the iPhone's screen on a simple, standard plain old ViewController's view. (And yes, I know that the example code on that page' readme is iOS ... and this was a Mac OSX question - so I've not tested it explicitly). Thanks, -Luther --- UIView *superview = self.view;NSDictionary *variables = NSDictionaryOfVariableBindings(label, superview);NSArray *constraints =[NSLayoutConstraint constraintsWithVisualFormat:@V:[superview]-(=1)-[label] options: NSLayoutFormatAlignAllCenterX metrics:nil views:variables];[self.view addConstraints:constraints]; constraints =[NSLayoutConstraint constraintsWithVisualFormat:@H:[superview]-(=1)-[label] options: NSLayoutFormatAlignAllCenterY metrics:nil views:variables];[self.view addConstraints:constraints]; On Fri, Oct 4, 2013 at 6:56 PM, jonat...@mugginsoft.com jonat...@mugginsoft.com wrote: On 4 Oct 2013, at 21:52, Kyle Sluder k...@ksluder.com wrote: On Fri, Oct 4, 2013, at 01:31 PM, jonat...@mugginsoft.com wrote: I have a fixed size custom OS X view that I load from a nib and want to centre within a host view using auto layout. Can this be done using VFL alone? No. Thanks for the confirmation. But it's still really simple to do in code. Simple and verbose. The VFL would be more concise. In reality I am just trying to figure out auto layout. Again, why are you concerning yourself with the view's size here? It is not necessary to explicitly specify a size in order to get centering behavior. I do see it as a necessity, given the approach listed. If a view provides intrinsic size info then explicit size constrains will not be required. A raw NSView instance requires the width/attributes to display correctly as far as my experiments have confirmed. This agrees with dumping layout constraints added in IB. In the following case auto layout fails because there are no size constraints. self.customview.translatesAutoresizingMaskIntoConstraints = NO; // we don't want any auto constraints applied [self.window.contentView addSubview: self.customview]; // recreate the fixed size centering constraints explictly /* [self.customview addConstraint:[NSLayoutConstraint constraintWithItem:self.customview attribute:NSLayoutAttributeWidth relatedBy:NSLayoutRelationEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1.0 constant:width]]; [self.customview addConstraint:[NSLayoutConstraint constraintWithItem:self.customview attribute:NSLayoutAttributeHeight relatedBy:NSLayoutRelationEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1.0 constant:height]]; */ [self.window.contentView addConstraint:[NSLayoutConstraint constraintWithItem:self.customview attribute:NSLayoutAttributeCenterX relatedBy:NSLayoutRelationEqual toItem:self.window.contentView attribute:NSLayoutAttributeCenterX multiplier:1.0 constant:0]]; [self.window.contentView addConstraint:[NSLayoutConstraint constraintWithItem:self.customview attribute:NSLayoutAttributeCenterY relatedBy:NSLayoutRelationEqual toItem:self.window.contentView attribute:NSLayoutAttributeCenterY multiplier:1.0 constant:0]]; Jonathan ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update
Re: Autolayout fixed size centering in VFL
Sorry, I just noticed the link in the original question that contains the answer I was referring to. Now I'm curious to know if that doesn't work on the desktop or if you need to describe more than those simple two lines for other types of content/child views. I'm sure the UIImageView I am using can determine its own intrinsic size. -Luther On Fri, Oct 4, 2013 at 10:22 PM, Luther Baker lutherba...@gmail.com wrote: First of all ... very much appreciate you both so often! Thanks for commenting as much as you do. I too faced this issue and, like Kyle, read enough to assume it was generally not possible with VFL. But this afternoon, I came across this: https://github.com/evgenyneu/center-vfl and for my specific case, it works perfectly. Let me know what you think ... and if you see caveats. I'm successfully using this technique to center an ImageView populated with an image much larger than the iPhone's screen on a simple, standard plain old ViewController's view. (And yes, I know that the example code on that page' readme is iOS ... and this was a Mac OSX question - so I've not tested it explicitly). Thanks, -Luther --- UIView *superview = self.view;NSDictionary *variables = NSDictionaryOfVariableBindings(label, superview);NSArray *constraints =[NSLayoutConstraint constraintsWithVisualFormat:@V:[superview]-(=1)-[label] options: NSLayoutFormatAlignAllCenterX metrics:nil views:variables];[self.view addConstraints:constraints]; constraints =[NSLayoutConstraint constraintsWithVisualFormat:@H:[superview]-(=1)-[label] options: NSLayoutFormatAlignAllCenterY metrics:nil views:variables];[self.view addConstraints:constraints]; On Fri, Oct 4, 2013 at 6:56 PM, jonat...@mugginsoft.com jonat...@mugginsoft.com wrote: On 4 Oct 2013, at 21:52, Kyle Sluder k...@ksluder.com wrote: On Fri, Oct 4, 2013, at 01:31 PM, jonat...@mugginsoft.com wrote: I have a fixed size custom OS X view that I load from a nib and want to centre within a host view using auto layout. Can this be done using VFL alone? No. Thanks for the confirmation. But it's still really simple to do in code. Simple and verbose. The VFL would be more concise. In reality I am just trying to figure out auto layout. Again, why are you concerning yourself with the view's size here? It is not necessary to explicitly specify a size in order to get centering behavior. I do see it as a necessity, given the approach listed. If a view provides intrinsic size info then explicit size constrains will not be required. A raw NSView instance requires the width/attributes to display correctly as far as my experiments have confirmed. This agrees with dumping layout constraints added in IB. In the following case auto layout fails because there are no size constraints. self.customview.translatesAutoresizingMaskIntoConstraints = NO; // we don't want any auto constraints applied [self.window.contentView addSubview: self.customview]; // recreate the fixed size centering constraints explictly /* [self.customview addConstraint:[NSLayoutConstraint constraintWithItem:self.customview attribute:NSLayoutAttributeWidth relatedBy:NSLayoutRelationEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1.0 constant:width]]; [self.customview addConstraint:[NSLayoutConstraint constraintWithItem:self.customview attribute:NSLayoutAttributeHeight relatedBy:NSLayoutRelationEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1.0 constant:height]]; */ [self.window.contentView addConstraint:[NSLayoutConstraint constraintWithItem:self.customview attribute:NSLayoutAttributeCenterX relatedBy:NSLayoutRelationEqual toItem:self.window.contentView attribute:NSLayoutAttributeCenterX multiplier:1.0 constant:0]]; [self.window.contentView addConstraint:[NSLayoutConstraint constraintWithItem:self.customview attribute:NSLayoutAttributeCenterY relatedBy:NSLayoutRelationEqual toItem:self.window.contentView attribute:NSLayoutAttributeCenterY
Re: Migrating Core Data models
On 2013 Oct 04, at 18:56, Rick Mann rm...@latencyzero.com wrote: … but Core Data seems to be deleting my database and starting fresh, anyway. I verified that if I don't set the auto-migration options, then it gets an error when it attempts to open the db. Rick, this looks like a case of You should look more carefully, because if things are really happening as you say, we're all in deep trouble. If Core Data presented an error, or maybe even failed silently to open the database, I could believe that, but *deleting* the database is pretty hard to imagine. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Autolayout fixed size centering in VFL
On Fri, Oct 4, 2013, at 08:22 PM, Luther Baker wrote: First of all ... very much appreciate you both so often! Thanks for commenting as much as you do. I too faced this issue and, like Kyle, read enough to assume it was generally not possible with VFL. But this afternoon, I came across this: https://github.com/evgenyneu/center-vfl and for my specific case, it works perfectly. Let me know what you think ... and if you see caveats. I'm successfully using this technique to center an ImageView populated with an image much larger than the iPhone's screen on a simple, standard plain old ViewController's view. This doesn't work on OS X, and I'm surprised it works on iOS. UIView *superview = self.view; NSDictionary *variables = NSDictionaryOfVariableBindings(label, superview); NSArray *constraints = [NSLayoutConstraint constraintsWithVisualFormat:@V:[superview]-(=1)-[label] options: NSLayoutFormatAlignAllCenterX metrics:nil views:variables]; [self.view addConstraints:constraints]; This specifies a relationship between the superview's bottom edge and the label's top edge, yet the label is a subview of the superview. When running on the Mac, I would expect NSLayoutConstraint to complain here , but I can see why it might not if the |- syntax is treated as a simple shortcut for whatever the superview happens to be. Indeed, if you try the equivalent on the Mac, you can see that this code throws an exception because it tries to install a constraint relating a view to another view upon that view itself: Unable to install constraint on view. Does the constraint reference something from outside the subtree of the view? That's illegal. constraint:NSLayoutConstraint:0x104406a00 V:[NSView:0x10060da80]-(=1)-[NSTextField:0x10012ac00] view:NSView: 0x10060da80 I've forked the project you linked to and uploaded my demo: https://github.com/kylesluder/center-vfl/ Also, I suspect the reason you're specifying center-X alignment when creating the vertical constraints is because NSLayoutConstraint threw an exception when you tried to use the center-Y alignment option. That should be warning enough. ;-) --Kyle Sluder ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Autolayout fixed size centering in VFL
Also, I suspect the reason you're specifying center-X alignment when creating the vertical constraints is because NSLayoutConstraint threw an exception when you tried to use the center-Y alignment option. That should be warning enough. ;-) This is true - as I typed this block into my own project I naturally lined up the V: vfl string with the Y constant and the H: vfl string with the X constant ... and it complained. I then noticed that evgenyneuhttps://github.com/evgenyneu/center-vfl had flipped them. Thanks - it now feels like this is an anomaly at best. -Luther On Fri, Oct 4, 2013 at 11:03 PM, Kyle Sluder k...@ksluder.com wrote: On Fri, Oct 4, 2013, at 08:22 PM, Luther Baker wrote: First of all ... very much appreciate you both so often! Thanks for commenting as much as you do. I too faced this issue and, like Kyle, read enough to assume it was generally not possible with VFL. But this afternoon, I came across this: https://github.com/evgenyneu/center-vfl and for my specific case, it works perfectly. Let me know what you think ... and if you see caveats. I'm successfully using this technique to center an ImageView populated with an image much larger than the iPhone's screen on a simple, standard plain old ViewController's view. This doesn't work on OS X, and I'm surprised it works on iOS. UIView *superview = self.view; NSDictionary *variables = NSDictionaryOfVariableBindings(label, superview); NSArray *constraints = [NSLayoutConstraint constraintsWithVisualFormat:@V:[superview]-(=1)-[label] options: NSLayoutFormatAlignAllCenterX metrics:nil views:variables]; [self.view addConstraints:constraints]; This specifies a relationship between the superview's bottom edge and the label's top edge, yet the label is a subview of the superview. When running on the Mac, I would expect NSLayoutConstraint to complain here , but I can see why it might not if the |- syntax is treated as a simple shortcut for whatever the superview happens to be. Indeed, if you try the equivalent on the Mac, you can see that this code throws an exception because it tries to install a constraint relating a view to another view upon that view itself: Unable to install constraint on view. Does the constraint reference something from outside the subtree of the view? That's illegal. constraint:NSLayoutConstraint:0x104406a00 V:[NSView:0x10060da80]-(=1)-[NSTextField:0x10012ac00] view:NSView: 0x10060da80 I've forked the project you linked to and uploaded my demo: https://github.com/kylesluder/center-vfl/ Also, I suspect the reason you're specifying center-X alignment when creating the vertical constraints is because NSLayoutConstraint threw an exception when you tried to use the center-Y alignment option. That should be warning enough. ;-) --Kyle Sluder ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com