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 12-13-2011, 05:14 PM   #1 (permalink)
Registered Member
 
Join Date: Aug 2011
Posts: 245
samurle is on a distinguished road
Question UILabel overlay?

I want to place a large, non-interactive transparent UILabel as an overlay on part of my screen, however,
it's interfering with with the controls/buttons underneath it. It's basically blocking all of my touches.
It won't allow me to click on anything.

I set this flag:
Quote:
myLabel.userInteractionEnabled = NO;
However, this doesn't help. It's still blocking.

Any suggestions?
samurle is offline   Reply With Quote
Old 12-13-2011, 10:29 PM   #2 (permalink)
Registered Member
 
Join Date: Aug 2011
Posts: 245
samurle is on a distinguished road
Question

If UILabel is based on UIView, how can I remove a UIView from the chain of touch responses, but still
keep its drawing order?
samurle is offline   Reply With Quote
Old 12-14-2011, 10:54 AM   #3 (permalink)
Cocoa Junkie
 
Duncan C's Avatar
 
Join Date: Dec 2008
Location: Northern Virginia
Posts: 6,005
Duncan C has a spectacular aura about
Default

Quote:
Originally Posted by samurle View Post
I want to place a large, non-interactive transparent UILabel as an overlay on part of my screen, however,
it's interfering with with the controls/buttons underneath it. It's basically blocking all of my touches.
It won't allow me to click on anything.

I set this flag:


However, this doesn't help. It's still blocking.

Any suggestions?
That's weird. Setting userInteractionEnabled to false should fix the problem. Is there any chance that the link to the label is broken, and that code is dealing with a nil outlet?

Set a breakpoint on that line, and make sure the pointer to your label is valid.
__________________
Regards,

Duncan C
WareTo

Check out our apps in the Apple App store


Check out this password generator app that shows various techniques including using a data container singleton object to share data between objects in your project.

See this tutorial on using UIView animations and layer animations:

See this thread on generating random, non-repeating text

Check out a very cool Macintosh Kaleidoscopes app called ScopeWorks that we released to the Mac App store.
Duncan C is online now   Reply With Quote
Old 12-14-2011, 06:44 PM   #4 (permalink)
Registered Member
 
Join Date: Aug 2011
Posts: 245
samurle is on a distinguished road
Default

Quote:
Originally Posted by Duncan C View Post
That's weird. Setting userInteractionEnabled to false should fix the problem. Is there any chance that the link to the label is broken, and that code is dealing with a nil outlet?

Set a breakpoint on that line, and make sure the pointer to your label is valid.
Thanks, you're correct, it works if I just add the label to the view and do nothing else to it.

However, I should mention that I also animate it so it fades out slowly. All of my clicks are
blocked when this animation is playing. Should it work like this?

This is what I'm doing:

Code:
// create label that covers the entire screen
CGRect rect = CGRectMake(0,0, self.view.frame.size.width, self.view.frame.size.height );
MyLabel *tmp = [[MyLabel alloc] initWithFrame:rect];
tmp.text = @"Testing";

// non-interactive
tmp.userInteractionEnabled = FALSE;

// save it
self.myLabel = tmp;
 
// add it to top of view
[self.view addSubview: tmp];
[tmp release];

// fade alpha
[self.myLabel animateFadeOut];

/////////////////////////////////////////////////////////////

-(void)animateFadeOut {

 self.alpha = 1.0f;
 float delay = 5.0;

 [UIView animateWithDuration: delay
         animations: ^{
               self.alpha = 0.0f;
         }
         completion: ^(BOOL finished) {
               // get rid of it
               [self removeFromSuperview];
         }];                 
}
samurle is offline   Reply With Quote
Old 12-15-2011, 03:54 PM   #5 (permalink)
Registered Member
 
Join Date: Aug 2011
Posts: 245
samurle is on a distinguished road
Default

If I animate a label, does the iOS sneak behind my back and automatically set userInteractionEnabled to TRUE?

I don't understand why an animating label blocks my clicks, and a non-animating label doesn't.
samurle is offline   Reply With Quote
Reply

Bookmarks

Tags
blocking, touches, uilabel, userinteractionenabled

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: 395
13 members and 382 guests
7twenty7, AppsBlogger, Creativ, David-T, Duncan C, HemiMG, heshiming, LunarMoon, Murphy, pbart, Sami Gh, teebee74, Tomsky
Most users ever online was 1,387, 04-10-2012 at 04:21 AM.
» Stats
Members: 175,676
Threads: 94,127
Posts: 402,915
Top Poster: BrianSlick (7,990)
Welcome to our newest member, jleannex55
Powered by vBadvanced CMPS v3.1.0

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