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 05-02-2011, 10:07 PM   #1 (permalink)
Registered Member
 
Join Date: Sep 2008
Posts: 17
saidev is on a distinguished road
Default uibutton inside uiscrollview, only button is touchable

I had this happen couple of years ago but I can't remember how I fixed it. Can anyone help refresh my memory?

I have scrollview, adding uibutton dynamically during runtime. Button shows up just fine, scrollview scrolls okay. The only problem is that the button title label is not touchable while other part of the button is touchable.

I've done something as simple as below and still got the same problem. It's almost like setTitle added a subview in the button that is not passing the events down to the button itself. I even try btn.titlelabel.userInteractionEnabled = YES as it was default to NO; and still no dice.

Code:
UIButton *btn = [UIButton buttonWithType:UIButtonTypeRoundedRect];
[btn setTitle:@"123" forState:UIControlStateNormal];
btn.frame = CGRectMake(10,10, 100, 100);
[scrollView addSubview:btn];
The scrollview have all the touch event passing params that I can think of:
scrollView.userInteractionEnabled = YES;
scrollView.delaysContentTouches = YES;
scrollView.exclusiveTouch = YES;
scrollview.canCancelContentTouches = YES;

TIA!
saidev is offline   Reply With Quote
Old 05-04-2011, 01:08 PM   #2 (permalink)
Registered Member
 
Join Date: Sep 2008
Posts: 17
saidev is on a distinguished road
Default

Figured it out, there was a method somewhere that loop thru all subviews to make UserInteractiveEnabled=YES. The UILabel inside the UIButton was set to that, but it's suppose to be NO.
saidev is offline   Reply With Quote
Reply

Bookmarks

Tags
uibutton, uiscrollview

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: 349
11 members and 338 guests
dansparrow, iOS.Lover, lorrettaui53, MikaelBartlett, Nobbsy, oztemel, pbart, PlutoPrime, sledzeppelin, thephotographer, Trickphotostudios
Most users ever online was 1,387, 04-10-2012 at 04:21 AM.
» Stats
Members: 175,663
Threads: 94,120
Posts: 402,898
Top Poster: BrianSlick (7,990)
Welcome to our newest member, LezB44
Powered by vBadvanced CMPS v3.1.0

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