Re: Workaround for Symbol not found: _SCDynamicStoreCreate on 10.4?
On Aug 23, 2010, at 12:46 PM, Greg Parker wrote: On Aug 23, 2010, at 12:20 PM, Sidney San Martín wrote: I'm developing for 10.4.11 and up, using -respondsToSelector: and NSClassFromString() to target different OSs at runtime, and it's gone super-smoothly so far. I just ran into an issue I can't figure out on my own. When I link to the System Configuration framework and IOKit, and target 10.4, calling some SystemConfiguration framework functions crashes my application with Symbol not found: _SCDynamicStoreCreate. This happens if I use any base SDK newer than 10.4, which is a bad thing for this project. This looks like a bug in the SDKs. I don't see the appropriate magic symbols that tell the linker the OS version when the function moved from IOKit to SystemConfiguration. You should file a bug report. You can use dlsym() to work around the problem. You can also be able to work around this by fiddling with the framework link order in your build. The problem is that you want the symbol from SystemConfiguration, but instead you're getting the symbol from IOKit. This dies on 10.4 because the symbol was not in IOKit then. If you can modify the link order so that SystemConfiguration comes before IOKit in the linker command, then the linker should choose the symbol from SystemConfiguration. To do this in Xcode: 1. Find your app in the Targets list on the left side of the project window. 2. Open the Link Binary With Libraries build phase. 3. Drag SystemConfiguration.framework to the top of the list. -- Greg Parker 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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Cocoa wrapper for libarchive
On 23 Aug 2010, at 10:46, jonat...@mugginsoft.com wrote: Is anyone aware of the existence of a Cocoa wrapper for libarchive? http://code.google.com/p/libarchive/ My only success with this has been to locate Per Johansson's ArchiveWrapper.m. http://bazaar.launchpad.net/%7Epelle-morth/modazipin/trunk/annotate/head%3A/ArchiveWrapper.m Unfortunately this only performs unarchiving however it could serve as a base for further expansion. Another issue is that OS X doesn't ship with all the necessary headers (especially archive_entry.h). These can be pulled in from the libarchive sources. A better solution however might be to construct a framework that builds and incorporates a local copy of libarchive. Regards Jonathan Mitchell Developer Mugginsoft LLP http://www.mugginsoft.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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
OgreKit Source Code
Hey all, I know this isn't strictly about Cocoa, but it's related enough. I'm looking for the source code for the OgreKit regex framework. The site that supposedly has the framework has vanished and while I have the built framework, I'd like to have the source in order to future proof myself. Does anyone have, or know where I can get, the source for OgreKit. Thanks - Martin Pilkington Writer of Weird Symbols pi...@mcubedsw.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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: OgreKit Source Code
On Tue, Aug 24, 2010 at 7:30 AM, Martin Pilkington pi...@mcubedsw.com wrote: Hey all, I know this isn't strictly about Cocoa, but it's related enough. I'm looking for the source code for the OgreKit regex framework. The site that supposedly has the framework has vanished and while I have the built framework, I'd like to have the source in order to future proof myself. Does anyone have, or know where I can get, the source for OgreKit. Some of the Etoile/GNUStep folks forked it a while back. Their source might be appealing because it looks to be maintained: http://svn.gna.org/viewcvs/etoile/trunk/Etoile/Frameworks/OgreKit/ Otherwise, googling Isao Sonobe turns up a couple promising places, including: http://is.gd/eAG26 Good luck, Geoff ___ 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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Syncing behaviour for core-data app
Dear list, I have a core-data app which can sync the data to mobile-me. I have a design question that perhaps others have already pondered. When is a good time to sync from the user's perspective? If I just do it automatically in the background I'm worried that the data will change via the sync while the user is working on the self-same data. Is there a recommended behaviour that stops the user getting a nasty surprise? For example, I would think it is bad form to update the data in a text field while the user is typing in there. I considered popping up a progress window but then I realised that would be a bad user experience as well. My app has the feature that it can be 'locked' which means the user doesn't input any more. Perhaps I should only sync during that state. I wonder how iCal et al handle this. I realise that in principle (since core-data over mobile-me is inherently a single user experience), this is unlikely to ever happen, but one can imagine the user starts the app and quickly goes to edit some data just as some previous edits (entered on another computer) get pulled down. Any thoughts gratefully received, Martin Martin Hewitson Albert-Einstein-Institut Max-Planck-Institut fuer Gravitationsphysik und Universitaet Hannover Callinstr. 38, 30167 Hannover, Germany Tel: +49-511-762-17121, Fax: +49-511-762-5861 E-Mail: martin.hewit...@aei.mpg.de WWW: http://www.aei.mpg.de/~hewitson ___ 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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Another Icon Question
I added CoreServices.framework to my project since it contains LaunchServices.framework. The referenced header is in LaunchServices.framework, but still not found. What do I need to do for the project to see this header? -koko On Aug 23, 2010, at 9:47 PM, Ken Thomases wrote: On Aug 23, 2010, at 9:59 PM, k...@highrolls.net wrote: cmd-double click does nothing for me and I also get : error: 'kToolbarDesktopFolderIcon' was not declared in this scope What am I dong wrong? What SDK are you building against? The toolbar icons were added in 10.6, apparently. Also, I'm not certain that the relevant header is included by default, so you may need to add: #include LaunchServices/LaunchServices Regards, Ken ___ 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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Another Icon Question
Hey! On 24/Aug/2010, at 7:43 AM, k...@highrolls.net wrote: I added CoreServices.framework to my project since it contains LaunchServices.framework. When I tried this, I had to explicitly include LaunchServices.framework The referenced header is in LaunchServices.framework, but still not found. What do I need to do for the project to see this header? And, I used this directive to import the headers: #import LaunchServices/LaunchServices.h Then things seemed to compile ok and command clicking 'kToolbarDesktopFolderIcon' took me to the proper header file. ;-) HTH! M. ___ 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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Saving Managed Object Context
That solved it. We made the reciprocal to-one relationship optional and it saved. Thanks, Joseph On Aug 23, 2010, at 5:48 PM, Quincey Morris wrote: On Aug 23, 2010, at 09:33, Ayers, Joseph wrote: NSError *error = nil; if (![[self managedObjectContext] save: error]) { NSLog(@Error while saving\n%@, ([error localizedDescription] != nil) ? [error localizedDescription]: @Unknown Error); Results in: 2010-08-22 20:31:32.385 Roboplasm[3508:a0f] Error while saving TapeList is a required value. The error means that some entity is defined to have a to-one relationship to TapeList, and the relationship property is defined to be non-optional, but in some object the relationship is actually nil. ___ 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: http://lists.apple.com/mailman/options/cocoa-dev/j.ayers%40neu.edu This email sent to j.ay...@neu.edu ___ 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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Another Icon Question
Le 24 août 2010 à 17:57, Mark Ritchie a écrit : Hey! On 24/Aug/2010, at 7:43 AM, k...@highrolls.net wrote: I added CoreServices.framework to my project since it contains LaunchServices.framework. When I tried this, I had to explicitly include LaunchServices.framework The referenced header is in LaunchServices.framework, but still not found. What do I need to do for the project to see this header? And, I used this directive to import the headers: #import LaunchServices/LaunchServices.h Don't include it directly. This is a subumbrella framework and should always be referenced though its parent framework. Instead use: #import CoreServices/CoreServices.h Then things seemed to compile ok and command clicking 'kToolbarDesktopFolderIcon' took me to the proper header file. ;-) HTH! M. -- Jean-Daniel ___ 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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Another Icon Question
On 24/Aug/2010, at 10:04 AM, Jean-Daniel Dupas wrote: Don't include it directly. This is a subumbrella framework and should always be referenced though its parent framework. Instead use: #import CoreServices/CoreServices.h Ah, good point. ;-) Thanks! M. ___ 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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Sample App Similar to Core Data Data Modeler?
Hi, I've been looking for some sample code similar to Core Data's data modeler. I've seen TreeView and I've watched the Crafting Custom Views presentation from WWDC 2010. Both are excellent, but, I'm hoping to find some code that shows views representing data that are connected with lines. I'm hoping to create a custom view that represents a device and has multiple connection points to connect the device's inputs and outputs to inputs and outputs of other devices. Users should be able to move the device views while lines stay connected. Hopefully, the lines are orthogonal. In sum, it's something very similar to the Core Data data modeler. Thanks in advance for any suggestions. Brad ___ 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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Document Cursor
On Aug 23, 2010, at 9:41 PM, Richard Somers wrote: If a new document is opened and the cursor happens to already be over the view, the cursor is not updated until it is moved out of the view and then back in. How can I fix this? None of the NSTrackingArea options address this issue. You can just check where the cursor is when you open your document and send [[NSCursor IBeamCursor] push] yourself if it's inside your view. -jcr ___ 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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Difference between NSOperationQueue and NSThread in iOS4?
I have a question that I have been researching but can't find an answer for. I have some iOS 3.2 code using NSOperation this doesn't work using NSOperation but works using NSThread withe detatch thread in iOS4 with the desired effect. My code is basically to create and generate pages for my paged scrollview in the background. Its basically a play on the WWDC picture scroller demo. I however have some almost full screen views we prepare in the background. The code look like: -(void) tilePages { @synchronized(self) { NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init]; CGRect visibleBounds = infoCardScroller.bounds; NSInteger firstNeededIndex = floorf(CGRectGetMinX(visibleBounds)/CGRectGetWidth(visibleBounds)); NSInteger lastNeededIndex = floorf((CGRectGetMaxX(visibleBounds)-1)/CGRectGetWidth(visibleBounds)); currentIndex = firstNeededIndex; firstNeededIndex = MAX(firstNeededIndex-1, 0); lastNeededIndex = MIN(lastNeededIndex+1, [songs count] - 1); // recycle no longer visible pages for (HVInfoCardContainer* infoCard in visibleViews) { if (infoCard.index firstNeededIndex || infoCard.index lastNeededIndex) { [recycledViews addObject:infoCard]; [infoCard removeFromSuperview]; } } [visibleViews minusSet:recycledViews]; // add missing pages. for (int index = firstNeededIndex; index = lastNeededIndex; index++) { if (![self isDisplayingContainerForIndex:index]) { HVInfoCardContainer* container = [self dequeueRecycledContainer]; if (container == nil) container = [[[HVInfoCardContainer alloc] init] autorelease]; [self configureContainer:container forIndex:index]; [infoCardScroller addSubview:container]; [visibleViews addObject:container]; } } [pool release]; } ; } I cached 3 views at most. I basically have the following when the view scrolls: - (void)scrollViewDidScroll:(UIScrollView *)scrollView; { [[NVGlobalQueue sharedNVGlobalQueue] cancelAllOperations]; [[NVGlobalQueue sharedNVGlobalQueue] addOperation:[[[HVInfoCardTileOperation alloc] initWithScroller:self] autorelease]]; } My operations's main is: -(void) main { if (!self.isCancelled) { [self setQueuePriority:NSOperationQueuePriorityVeryHigh]; [scrollerController tilePages]; } } } } On iOS 3.2 i get what i expect. The third view is created and rendered as we scroll to the 2nd one. So i have 3 views in the my scroller full rendered as I scroll to the 2nd one. However, on iOS4 this isn't working I don't get my 3rd one for a few seconds after its scrolled too. However if i change to: - (void)scrollViewDidScroll:(UIScrollView *)scrollView { [NSThread detachNewThreadSelector:@selector(tilePages) toTarget:self withObject:nil]; } This works great and scrolls as smooth as butter. I don't mind doing this since there is a check to see if we have to actually create the view (could probably make the tileView call even smarter). But why would this not work over NSOperation on iOS4 but work in 3.2? Going to the main thread isn't an options as it chunks the scroll And no removing the cancelAllOperations doesn't help. Scott Andrew___ 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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Navigation Services
Will / is Navigation Services available , will be available in OSX moving forward. -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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Navigation Services
On Aug 24, 2010, at 3:09 PM, k...@highrolls.net wrote: Will / is Navigation Services available , For 32-bit apps, yes. For 64-bit apps, no. will be available in OSX moving forward. I doubt it. Navigation Services was replaced by NSOpenPanel/NSSavePanel a long time ago. Nick Zitzmann http://www.chronosnet.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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Document Cursor
On Aug 24, 2010, at 11:38 AM, John C. Randolph wrote: You can just check where the cursor is when you open your document and send [[NSCursor IBeamCursor] push] yourself if it's inside your view. This does not work for me. The following code is used to set the cursor when ever the window containing the view becomes key and the cursor is inside the view. I have confirmed that [[NSCursor crosshairCursor] set] is called but nothing happens. The cursor does not change. @implementation MyCustomDocumentView - (void)windowDidBecomeKeyNotification:(NSNotification *)notification { if ([notification object] == [self window]) { NSPoint point = [[self window] mouseLocationOutsideOfEventStream]; NSRect frame = [self convertRectToBase:[self frame]]; BOOL condition = NSMouseInRect(point, frame, NO); if (condition) { [[NSCursor crosshairCursor] set]; // Called but does not work! } } } @end The following code will change the cursor but only when it enters the tracking area. If the cursor is already inside the area then it does not work. I have tried all the tracking area options. Nothing seems to work. @implementation MyCustomDocumentView - (void)awakeFromNib { NSTrackingAreaOptions options = NSTrackingCursorUpdate | NSTrackingActiveWhenFirstResponder | NSTrackingInVisibleRect; _trackingArea = [[NSTrackingArea alloc] initWithRect:[self frame] options:options owner:self userInfo:nil]; [self addTrackingArea:_trackingArea]; } - (void)cursorUpdate:(NSEvent *)event { [[NSCursor crosshairCursor] set]; } @end There are lots of applications that when a window is activated by a mouse click with the mouse over a tracking area, the cursor will change. You do not need to exit and re-enter the tracking area. This should be elementary stuff. But I can't figure out how to do it. --Richard ___ 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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Sample App Similar to Core Data Data Modeler?
You will find a similar connected lines to inputs and outputs interface in Quartz Composer. I don't think Apple has provided source code for either approach, but it is not that hard. One of my company's products contained a similar interface in NeXTstep (proto-Cocoa) in ~1996. We collaborated with some contract engineers who adapted a famous circuit board layout algorithm to our purposes so that connection lines would automatically reroute to preserve 90 deg. angles and minimize crossing lines as the boxes containing inputs and outputs are dragged around. Apple still hasn't caught up to our implementation ;) You can start from Apple's Sketch sample application source code for inspiration creating the graphics that can be dragged. Our application used NSCell subclasses to represent the inputs and outputs and host connection lines. For another example, there is a simple drawing application from Cocoa Design Patterns available freely in CocoaDesignPatternsSampleCode.zip at http://www.cocoadesignpatterns.com/sample-code/ See Ch29. It would be fun and interesting to add connection lines between the boxes in the Ch29 example. ___ 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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Navigation Services
Yes, I know NSOpenPanel etc but Nav services had a cleaner way to display a preview than the accessory view provides. I need to create a preview if my qlgenerator is not installed and since the accessory view look clunky I was just thinking oh well, on to clunksville! -koko On Aug 24, 2010, at 3:28 PM, Nick Zitzmann wrote: On Aug 24, 2010, at 3:09 PM, k...@highrolls.net wrote: Will / is Navigation Services available , For 32-bit apps, yes. For 64-bit apps, no. will be available in OSX moving forward. I doubt it. Navigation Services was replaced by NSOpenPanel/ NSSavePanel a long time ago. Nick Zitzmann http://www.chronosnet.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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Document Cursor
On Aug 24, 2010, at 4:27 PM, Richard Somers wrote: There are lots of applications that when a window is activated by a mouse click with the mouse over a tracking area, the cursor will change. You do not need to exit and re-enter the tracking area. This should be elementary stuff. But I can't figure out how to do it. Wow, there are apparently issues with NSTrackingArea. Quincey Morris wrote The NSTrackingArea Report in February 2008. http://lists.apple.com/archives/Cocoa-dev/2008/Feb/msg00035.html I did not see my particular issue in Quincey's report. It would seem that all the apps that handle this correctly (Safari, TextEdit, Pages, etc.) do not use NSTrackingArea but use the legacy methods or something else. But what is strange is that according to the documentation The underlying implementation for the legacy methods is based on NSTrackingArea... --Richard ___ 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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Relation of UIView layer to drawRect:
What is the relationship of a UIView's layer (and its sublayers) to what happens when that UIView's drawRect: is called? I would expect the code below to draw a diagonal line across (i.e. on top of) the image, but it looks like the line is drawn behind the image. In other words, all I see is the image. @implementation MyView - (void)awakeFromNib { CALayer *imgLayer = [CALayer layer]; imgLayer.position = CGPointMake(self.bounds.size.width / 2, self.bounds.size.height / 2); imgLayer.bounds = self.bounds; imgLayer.contents = (id)[[UIImage imageNamed: @myimage.jpg] CGImage]; [self.layer addSublayer: imgLayer]; } - (void)drawRect: (CGRect)rect { CGMutablePathRef path = CGPathCreateMutable(); CGPathMoveToPoint(path, NULL, 0, 0); CGPathAddLineToPoint(path, NULL, self.bounds.size.width, self.bounds.size.height); CGContextRef context = UIGraphicsGetCurrentContext(); UIColor *black = [UIColor colorWithRed: 0 green: 0 blue: 0 alpha: 0.5]; CGContextSetStrokeColorWithColor(context, black.CGColor); CGContextSetLineWidth(context, 10); CGContextSetLineCap(context, kCGLineCapRound); CGContextAddPath(context, path); CGContextStrokePath(context); CFRelease(path); } @end Any hints? Thanks, 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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Relation of UIView layer to drawRect:
Adding a sublayer to self.layer works just like adding a subview to self. Sublayers are drawn on top of their superlayers. In this case the superlayer is your view, so the image in the sublayer will be rendered on top of whatever you draw in drawRect: Luke Sent from my iPhone. On Aug 24, 2010, at 8:47 PM, David F. dav...@gmx.us wrote: What is the relationship of a UIView's layer (and its sublayers) to what happens when that UIView's drawRect: is called? I would expect the code below to draw a diagonal line across (i.e. on top of) the image, but it looks like the line is drawn behind the image. In other words, all I see is the image. @implementation MyView - (void)awakeFromNib { CALayer *imgLayer = [CALayer layer]; imgLayer.position = CGPointMake(self.bounds.size.width / 2, self.bounds.size.height / 2); imgLayer.bounds = self.bounds; imgLayer.contents = (id)[[UIImage imageNamed: @myimage.jpg] CGImage]; [self.layer addSublayer: imgLayer]; } - (void)drawRect: (CGRect)rect { CGMutablePathRef path = CGPathCreateMutable(); CGPathMoveToPoint(path, NULL, 0, 0); CGPathAddLineToPoint(path, NULL, self.bounds.size.width, self.bounds.size.height); CGContextRef context = UIGraphicsGetCurrentContext(); UIColor *black = [UIColor colorWithRed: 0 green: 0 blue: 0 alpha: 0.5]; CGContextSetStrokeColorWithColor(context, black.CGColor); CGContextSetLineWidth(context, 10); CGContextSetLineCap(context, kCGLineCapRound); CGContextAddPath(context, path); CGContextStrokePath(context); CFRelease(path); } @end Any hints? Thanks, 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: http://lists.apple.com/mailman/options/cocoa-dev/luketheh%40apple.com This email sent to luket...@apple.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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Autorelease Pool Question.
I am wondering if releasing the autorelease pool is the same as draining. If it's not, will releasing cause the objects not to be released? I am just wondering as I am using release in my applications and it would be bad if it didn't release the objects in it.___ 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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com