Discussion Forums  >  Plugins, Customizing, Source Code

Replies: 1    Views: 112

Absentia
buzztouch Evangelist
Profile
Posts: 960
Reg: Oct 20, 2011
Alaska
20,600
10/19/12 01:15 AM (13 years ago)

How to hide a custom UIbutton (appoxee)

I've been working on implementing appoxee into my iOS app - it's been a huge headache. I've seen the awesome tutorial that Everest11 put together and I've read over the huge thread that he started - http://www.buzztouch.com/forum/thread.php?tid=37FAB953175EE7E08F95349 ...despite all that I still can't get it to do exactly what I want. The thing is, that tutorial basically just covers apps with a tab layout. I changed the code a bit to work with a list layout by changing "rootTabBarController.viewControllers objectAtIndex: 0" to "rootNavController.retain retain" as somebody suggested in that thread. This actually did get the mail icon to show in the top right corner of the nav bar, but for some reason it wont show the little red badge that indicates new messages - a pretty vital feature in my opinion So I tried Everest's method of creating a custom UIbutton and positioning it in the upper right corner - this makes it looks like a nav bar button, but it's really just an independent button...that code looks like this - ///////Insert Button for iPhone appoxeeButton = [[UIButton buttonWithType:UIButtonTypeCustom] retain]; appoxeeButton.frame = CGRectMake(290, 25, 24, 16); [appoxeeButton setBackgroundImage:[UIImage imageNamed:@envelope_white.png] forState:UIControlStateNormal]; appoxeeButton.layer.borderColor=[UIColor clearColor].CGColor; appoxeeButton.backgroundColor = [UIColor clearColor]; [appoxeeButton addTarget:self action:@selector(showAppoxee) forControlEvents:UIControlEventTouchDown]; [self.window addSubview:appoxeeButton]; //END Code This seems to work great at first - the button shows up and the badge shows up as well. The issue is that the button never goes away. I only want it to show on the home screen, but it hovers over the Nav Bar for the entire session no matter what screen I'm on...it just looks very weird, and it causes a few bugs. Is there any way to tweak the above code so that the button only shows on the main menu? If not, can anybody explain to me why button wont show a badge when it is set in the nav bar on a list menu?
 
awesome123
Aspiring developer
Profile
Posts: 132
Reg: Dec 27, 2011
location unknow...
2,320
like
11/17/12 06:08 PM (13 years ago)
hi absentia, have you made this work by yourself?
 

Login + Screen Name Required to Post

pointerLogin to participate so you can start earning points. Once you're logged in (and have a screen name entered in your profile), you can subscribe to topics, follow users, and start learning how to make apps like the pros.