Advertise Mobile SDKs Books Events Forum News Social Networking Support Us
Follow @iphonedevsdk on Twitter

Interface 2, Advanced iOS
Mockup & Code Gen
($9.99)

Make your own iPhone apps
and run them live!
(free)

Pic Frame Dynamo: Photo Editing
($0.99)

Abiliator
($1.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum > iPhone SDK Development Forums > iPhone SDK Development

Reply
 
LinkBack Thread Tools Display Modes
Old 09-12-2010, 10:52 AM   #1 (permalink)
Registered Member
 
Join Date: Oct 2008
Posts: 247
c0der is on a distinguished road
Default Core graphics draws behind UIImageView

Hello everyone,

I've got a UIImageView in my main window. In DrawRect, I get the context and draw using CG methods, but it's drawing BEHIND my UIImageView.

How can I get core graphics to draw ON TOP of the UIImageView?

Thanks!
c0der is offline   Reply With Quote
Old 09-12-2010, 11:12 AM   #2 (permalink)
Registered Member
 
Join Date: Nov 2009
Posts: 580
ChrisL is on a distinguished road
Default

Subviews are always displayed on top of their superviews, so if you're overriding the drawRect method of the main view, the behavior you're seeing is expected.

If you mean that you're overriding the drawRect method of the UIImageView itself, that won't work because UIImageView doesn't call drawRect on its subclasses (as discussed in the documentation under "Special considerations").

If you want to draw on top of the image view, you'll need to add another UIView on top of it and do your drawing on that view. You'll need to make its background color clear ([UIColor clearColor]), and set its opaque property to NO so that the background shows through properly.
ChrisL is offline   Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



» Advertisements
» Online Users: 344
10 members and 334 guests
cgokey, givensur, iGamesDev, jenniead38, linkmx, mraalex, PixelInteractive, raihan.zbr, Trickphotostudios
Most users ever online was 1,387, 04-10-2012 at 04:21 AM.
» Stats
Members: 175,657
Threads: 94,116
Posts: 402,889
Top Poster: BrianSlick (7,990)
Welcome to our newest member, jenniead38
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 12:01 AM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0