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 11-19-2011, 03:23 PM   #1 (permalink)
Registered Member
 
Join Date: Jan 2010
Location: MA
Posts: 126
nd049 is on a distinguished road
Default UIBarButtonItem Odd Behavior

Hi Everyone,

I have a music player (sub-class of a UIToolbar) that has 4 UIBarButtonItems on it.

1) Fixed space
2 - 4) Back, Play, Forward buttons

Everything is functioning correctly, except the back button. The issue is that even when I tap the the left of the back button the button is still being pressed some how. The image below shows where I am tapping on the toolbar and where the button is being pressed.



The button also is working if you push down directly on top of the icon. The code that I am using to add these items to the toolbar is:

Code:
UIBarButtonItem *bufferSpace = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFixedSpace target:self action:nil];
    bufferSpace.width = buttonStartX; //buttonStartX = 180
    
    backButton = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemRewind target:self action:@selector(previousSong:)];
    playButton = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemPlay target:self action:@selector(playPauseSong:)];
    pauseButton = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemPause target:self action:@selector(playPauseSong:)];
    nextButton = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFastForward target:self action:@selector(nextSong:)];
    
    backButton.style = UIBarButtonItemStyleBordered;
    playButton.style = UIBarButtonItemStyleBordered;
    pauseButton.style = UIBarButtonItemStyleBordered;
    nextButton.style = UIBarButtonItemStyleBordered;     
    
    NSArray *items = [[NSArray alloc] initWithObjects: bufferSpace, backButton, playButton, nextButton, nil];
    [self setItems:items animated:YES];
    [items release];
Any help is appreciated!
nd049 is offline   Reply With Quote
Old 11-21-2011, 11:43 AM   #2 (permalink)
Registered Member
 
Join Date: Jan 2010
Location: MA
Posts: 126
nd049 is on a distinguished road
Default

Anyone have an idea?
nd049 is offline   Reply With Quote
Old 11-21-2011, 02:08 PM   #3 (permalink)
Registered Member
 
Join Date: Dec 2010
Location: Seattle, WA
Posts: 408
RickSDK is on a distinguished road
Default

hmmm well you are adding 4 buttons but I only see 3. something is not quite right.
RickSDK is offline   Reply With Quote
Old 11-21-2011, 02:28 PM   #4 (permalink)
Registered Member
 
Join Date: Jan 2010
Location: MA
Posts: 126
nd049 is on a distinguished road
Default

Quote:
Originally Posted by RickSDK View Post
hmmm well you are adding 4 buttons but I only see 3. something is not quite right.
The first button is UIBarButtonSystemItemFixedSpace so you wouldn't see it. I am initializing the fixed space and 4 buttons, but I only add three of the buttons to the items array.
nd049 is offline   Reply With Quote
Old 11-22-2011, 12:41 PM   #5 (permalink)
Registered Member
 
Join Date: Jan 2010
Location: MA
Posts: 126
nd049 is on a distinguished road
Default

UPDATE:

I was curious so I changed the fixed space to 130 instead of 180 to allow a little room on the other side of the toolbar, and I found that the same behavior is happening for the next button as well when there is room. Maybe this is an issue with using a UIToolbar? Any thoughts?
nd049 is offline   Reply With Quote
Reply

Bookmarks

Tags
uibarbuttoitem, uitoolbar

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: 380
18 members and 362 guests
7twenty7, Alex-alex, Apptronics RBC, baja_yu, chiataytuday, Clouds, dedeys78, dre, Duncan C, e2applets, ipodphone, jeroenkeij, leostc, matador1978, mbadegree, QuantumDoja, Retouchable, usernametaken
Most users ever online was 1,387, 04-10-2012 at 04:21 AM.
» Stats
Members: 175,676
Threads: 94,125
Posts: 402,910
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:29 AM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0