Re: White rectangle behind UIAlertView when subview clipsToBounds
Re: White rectangle behind UIAlertView when subview clipsToBounds
- Subject: Re: White rectangle behind UIAlertView when subview clipsToBounds
- From: Diederik Meijer | Ten Horses <email@hidden>
- Date: Thu, 15 May 2014 21:39:31 +0200
Update: this sequence of steps is a workaround that avoids the problem:
1. Setting the view that should remain invisible hidden;
2. Setting clipsToBounds on its parent to NO;
3. Now create and show the alert;
4. On a tap on the 'OK' button, reverse 1 and 2, meaning:
5. Set clipsToBounds on the parent to YES;
6. Setting the view that should remain invisible's hidden property to NO.
This is not problematic because the UIAlertView takes over the entire interface, so there is no harm in making it impossible for the hidden view to animate into my visible area.
Nevertheless, it does seem strange I need these steps to have a normal UIAlertView experience in my use case, so I'm still very interested in helpful feedback!
Op May 15, 2014, om 8:23 PM heeft Diederik Meijer | Ten Horses <email@hidden> het volgende geschreven:
> Hi David,
>
> Many thanks for your quick response!
>
> UIAlertView is called here:
>
> -(void)welcomeAlert {
> if (![[NSUserDefaults standardUserDefaults] objectForKey:@"welcomeAlertShown"] || [[[NSUserDefaults standardUserDefaults] valueForKey:@"welcomeAlertShown"] isEqual:@"NO"]) {
> UIAlertView *av = [[UIAlertView alloc] initWithTitle:@"Welcome to 365 days of Flow!" message:@"\nPlease swipe left or right to browse\n\nTap the screen to find the menu for more options" delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil, nil];
> [av show];
> [[NSUserDefaults standardUserDefaults] setValue:@"YES" forKey:@"welcomeAlertShown"];
> [[NSUserDefaults standardUserDefaults] synchronize];
> }
> }
>
>
>
> So indeed, simply by 'show'.
>
>
> View hierarchy is as follows:
>
> ViewController's view
> UIImageView for fullscreen background image (image changes when user scrolls, the UIScrollView below)
> UIImageView for transparent PNG background image (image changes when user scrolls, the UIScrollView below)
> UIView (the centred iPhone5-like view)
> UIScrollView
> 3 UILabels (for the date strings)
> 3 UIImageViews (for the images)
> UIView (separate view with sharing buttons, shown/hidden by button click)
> UIView (Date selector view with UIPickerView, kept offscreen, animates into
>
> Screenshot from Xcode/IB: http://www.tenhorses.com/apps/IBscreenshot.png
>
> As mentioned, if I turn off clipsToBounds on the centred iPhone5-like UIView, I have no problems with the alert, but then my last UIView (Date selector view) becomes visible, which is something I can't have…
>
> To me it seems the view hierarchy is slightly complex, but not to any kind of extreme.
>
> Many thanks again,
>
> Diederik
>
>
>
>
>
> Op May 15, 2014, om 6:53 PM heeft David Duncan <email@hidden> het volgende geschreven:
>
>>
>> On May 15, 2014, at 8:42 AM, Diederik Meijer | Ten Horses <email@hidden> wrote:
>>
>>> Dear list,
>>>
>>> I implemented a very straightforward UIAlertView.
>>>
>>> For some reason, on iPad, a light rectangular appears behind the alertview, here is what it looks like:
>>>
>>> http://www.tenhorses.com/apps/alertScreenshot.jpg
>>>
>>> What makes it strange is that that light rectangle is not visible when I take a screenshot, see jpg
>>>
>>> This only happens on iPad, not on iPhone.
>>>
>>> The centre part (the white card on the larger background) is a UIView that has a number of subviews.
>>>
>>> This UIView has clipsToBounds set to yes, because I have subviews flying in with animations.
>>>
>>> If I set clipsToBounds to NO, then the alertview is shown normally without any issues.
>>>
>>> Has anybody run into this and is there a way to fix this?
>>
>> When it doesn’t appear in screenshots it usually means its a transient compositing error (as the screenshot re-composites the screen).
>>
>> I’m not certain what exactly would cause this, but you might be served by better describing your view hierarchy (and I assume you are showing your alert with the -show method, and that it is a plain UIAlertView and not a subclass).
>>
>>>
>>> Many thanks,
>>>
>>> Diederik
>>>
>>>
>>> _______________________________________________
>>>
>>> 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
>>
>> --
>> David Duncan
>>
>>
>
> _______________________________________________
>
> 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
_______________________________________________
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