• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: [iPhone] Black background behind UIView??
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [iPhone] Black background behind UIView??


  • Subject: Re: [iPhone] Black background behind UIView??
  • From: PCWiz <email@hidden>
  • Date: Sun, 14 Feb 2010 12:26:26 -0700

That did the trick, thanks :)


Independent Cocoa Developer, Macatomy Software
http://macatomy.com


On 2010-02-14, at 12:22 AM, David Duncan wrote:

> On Feb 13, 2010, at 9:45 PM, PCWiz wrote:
>
>> I have a really simple UIView subclass, all it contains is this:
>>
>> - (void)drawRect:(CGRect)rect
>> {
>> 	CGContextRef ctx = UIGraphicsGetCurrentContext();
>> 	CGContextSetRGBFillColor(ctx, 1.0f, 1.0f, 1.0f, 1.0f);
>> 	CGContextFillEllipseInRect(ctx, CGRectMake(10.0f, 10.0f, 100.0f, 100.0f));
>> }
>>
>> It should draw a white circle. To use it, I'm programatically creating the view using UIView initWithFrame: then adding it as a subview in my UIViewController's viewDidLoad method. The problem is that a black square appears behind the circle. I don't know if this is due to the fact that there are several CALayers under the view. Any suggestions?
>
>
> By default views are opaque, and the backing store for the view is likely filled with zeros (this is not guaranteed, but common) so the view's backing store is interpreted as a white circle on a black background.
>
> If you set opaque=NO, then you may get white on a clear background, but you can only guarantee such behavior if you set backgroundColor=[UIColor clearColor];
> --
> David Duncan
> Apple DTS Animation and Printing
>

_______________________________________________

Cocoa-dev mailing list (email@hidden)

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:

This email sent to email@hidden

References: 
 >[iPhone] Black background behind UIView?? (From: PCWiz <email@hidden>)
 >Re: [iPhone] Black background behind UIView?? (From: David Duncan <email@hidden>)

  • Prev by Date: Re: Dock position and size
  • Next by Date: Re: Executing shell script with root privilege
  • Previous by thread: Re: [iPhone] Black background behind UIView??
  • Next by thread: Executing shell script with root privilege
  • Index(es):
    • Date
    • Thread