Customizing tap bar controller

Well i have two navigation controllers on a tab bar controller this is my code
- (void)applicationDidFinishLaunching:(UIApplication *)application {
navController = [[UINavigationController alloc]init];
tabBarController =[[UITabBarController alloc]init];
PersonListViewController *personListViewController = [[PersonListViewController alloc]initWithNibName:@"PersonListViewController" bundle:[NSBundle mainBundle]];
recent = [[UINavigationController alloc]init];
[navController pushViewController:personListViewController animated:NO];
personListViewController.title=@"contacts";
recent.title=@"recent";
tabBarController.viewControllers = [NSArray arrayWithObjects:navController,recent,nil];
// Override point for customization after application launch
[window addSubview:tabBarController.view];
[window makeKeyAndVisible];
and i want to customize the tab bar buttons with an image and a title. The title is already set up with the image now i know i have to use this part of code - (void)viewDidLoad {
UITabBarItem *item = [[UITabBarItem alloc] initWithTitle:@“recent”
image:[UIImage imageNamed:@“contact.png”]
tag:0]; self.tabBarItem = item;
[item release];
But nothing shows up.
Message was edited by: ZaaBI_AlonSo
Message was edited by: ZaaBI_AlonSo

ZaaBI_AlonSo wrote:
i want to customize the tab bar buttons with an image and a title. ... i know i have to use this part of code ...
It might be more logical to make the tab bar items in applicationDidFinishLaunching:, but you can make them in the root view controller of the first tab if you prefer. However, the tab bar items need to belong to the controllers which are connected directly to the tab bar controller. In this case, those would be the navigation controllers:
// PersonListViewController.m
- (void)viewDidLoad {
[super viewDidLoad];
UITabBarItem *item = [[UITabBarItem alloc] initWithTitle:@"eggplant"
image:[UIImage imageNamed:@"contact.png"] tag:0];
self.navigationController.tabBarItem = item; // <-- corrected line
[item release];
- Ray

Similar Messages

  • Triggering a custom action in a tab bar controller

    Hey guy,
    As you know, normally, when you click an item in a tab bar it is going to load a view right?
    But I was wondering if there is a way to trigger a custom action when you click an item in a tab bar controller instead of loading a view.
    If there is a way to do it, then how to do it?

    Hi David -
    Daviiidddd wrote:
    if there is a way to trigger a custom action when you click an item in a tab bar controller instead of loading a view.
    I think the implementation would depend on whether you wanted the custom action item to remain "selected", and if so, for how long? In other words, is the action item momentary or selectable? In either case, can we assume that tapping the action item leaves the current view visible? If not, what will the user see? Will the action item be visible from all the other views?
    As you know, normally, when you click an item in a tab bar it is going to load a view right? \[emphasis added by friendly neighborhood helper\]
    If you see most of us nodding, "yes", in agreement, it might be time to review [Tab Bars|http://developer.apple.com/iphone/library/documentation/UserExperience/Con ceptual/MobileHIG/SpecialViews/SpecialViews.html#//apple_ref/doc/uid/TP40006556- CH10-SW13] in the +iPhone Human Interface Guidelines+. Make sure your idea doesn't do something tab bars aren't expected to do. If you're not sure, look at some of the other UI options, e.g. [Toolbars|http://developer.apple.com/iphone/library/documentation/UserExperienc e/Conceptual/MobileHIG/SpecialViews/SpecialViews.html#//apple_ref/doc/uid/TP4000 6556-CH10-SW10], to see if there's a better fit for what you're doing.
    \- Ray

  • Loading a Tab Bar Controller

    Hi,
    I am trying to make an iPhone application where there will be a settings view that is made of a tab bar controller. I have declared the tabBarController, and linked it to the app delegate in the main window.xib file. However, when I try to switch to it by pressing my button that should start the IBAction to switch to it, the app terminates due to an uncaught exception. Here is my code:
    -(void)switchToSettings {
    [UIView beginAnimations:nil context:NULL];
    [UIView setAnimationDuration:1.5];
    [UIView setAnimationTransition:UIViewAnimationTransitionFlipFromRight forView:window cache:YES];
    [[gameViewController view] removeFromSuperview];
    [self.window addSubview:[settingsTabBarController view]];
    [UIView commitAnimations];
    gameViewController = nil;
    Someone please help! Thanks in advance.

    Hi David -
    Daviiidddd wrote:
    if there is a way to trigger a custom action when you click an item in a tab bar controller instead of loading a view.
    I think the implementation would depend on whether you wanted the custom action item to remain "selected", and if so, for how long? In other words, is the action item momentary or selectable? In either case, can we assume that tapping the action item leaves the current view visible? If not, what will the user see? Will the action item be visible from all the other views?
    As you know, normally, when you click an item in a tab bar it is going to load a view right? \[emphasis added by friendly neighborhood helper\]
    If you see most of us nodding, "yes", in agreement, it might be time to review [Tab Bars|http://developer.apple.com/iphone/library/documentation/UserExperience/Con ceptual/MobileHIG/SpecialViews/SpecialViews.html#//apple_ref/doc/uid/TP40006556- CH10-SW13] in the +iPhone Human Interface Guidelines+. Make sure your idea doesn't do something tab bars aren't expected to do. If you're not sure, look at some of the other UI options, e.g. [Toolbars|http://developer.apple.com/iphone/library/documentation/UserExperienc e/Conceptual/MobileHIG/SpecialViews/SpecialViews.html#//apple_ref/doc/uid/TP4000 6556-CH10-SW10], to see if there's a better fit for what you're doing.
    \- Ray

  • Xcode4 Where is the Tab Bar Controller

    Hello,
    I am learning Xcode4 now and I am trying to build a Tab bar & Nav bar combined app. There is a great video tutorial about how to do it in Xcode 3.~, but when I try to do the same in Xcode4, I get stuck because I do not find the "Tab Bar Controller" allowing me to change the type of view controllers. Opening the same project in Xcode3 is working like a charm.
    Does anyone has the same problem? Sorry, this might be a pretty dumb question, as I'm a newbe!!
    The Xcode 3.xx tutorial
    http://www.youtube.com/watch?v=LBnPfAtswgw
    The Tab Bar Controller in Xcode3
    http://eremiya.net/share/xcode4-tabbarcontroller.png

    I think I have found a solution.
    Instead of going about as you would in Xcode 3 and in the video, you follow these steps:
    Select the view controller that you wish to change to a navigation controller - This can be done by either selecting the view controller under the 'objects' section of the expanded dock on the left hand side, or selecting the tab bar button that relates to the view controller
    In the Identity Inspector, change the 'Class' drop down menu (under the 'Custom Class' header) to 'UINavigationController'
    That should work
    null

  • How can I remove google custom search bar from about:newtab page

    When I open Firefox or a new tab I have it set to about:newtab which is great and all. Just recently I noticed a Google search bar on the new tab page though, that it immediately sets my cursor to. I prefer typing in the normal address bar at top. If I don't think to take that extra tedious step to click on the address bar before typing it opens to Google Custom Search Engine. Which does not have the images, maps, etc tabs along top. Making a simple task of researching something or other purpose just that much more annoying to do, because I'll have to type into the address bar anyways.
    So I was hoping there is a way to remove this annoying Google Custom Search Bar from my about:newtab?
    Or at the least make my cursor start in the address bar, not the Google Custom Search Bar.
    This is a screen-cap of the Search Bar. http://gyazo.com/d75ccdea9b9d0bb4a3d347664be73771

    Sometimes a problem with Firefox may be a result of malware installed on your computer, that you may not be aware of.
    You can try these free programs to scan for malware, which work with your existing antivirus software:
    * [http://general-changelog-team.fr/downloads/viewdownload/20-outils-de-xplode/2-adwcleaner ADWCleaner]
    * [http://www.microsoft.com/security/scanner/default.aspx Microsoft Safety Scanner]
    * [http://www.malwarebytes.org/products/malwarebytes_free/ MalwareBytes' Anti-Malware]
    * [http://support.kaspersky.com/faq/?qid=208283363 TDSSKiller - AntiRootkit Utility]
    * [http://www.surfright.nl/en/hitmanpro/ Hitman Pro]
    * [http://www.eset.com/us/online-scanner/ ESET Online Scanner]
    [http://windows.microsoft.com/MSE Microsoft Security Essentials] is a good permanent antivirus for Windows 7/Vista/XP if you don't already have one.
    Further information can be found in the [[Troubleshoot Firefox issues caused by malware]] article.
    Did this fix your problems? Please report back to us!

  • More than 5 tabs in tab bar controller

    Hi,
    I'm totally at a lost trying to get 6 tabs connected to my tab bar controller, which was created using the tab bar controller template.  Everything thing works fine with 5 view controllers.  When I add a 6th view controller I get the "More" tab in the 5th position, which when touched opens up a table view showing 2 more tabs for the user to choose from.  Touching either row in this table view causes the app to crash.  The error reads:
    2011-06-26 20:37:25.276 TMO[2761:207] will dissapear
    2011-06-26 20:37:27.157 TMO[2761:207] -[UIMoreListController __touchesEnded:withEvent:]: unrecognized selector sent to instance 0x4c3c010
    2011-06-26 20:37:27.159 TMO[2761:207] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[UIMoreListController __touchesEnded:withEvent:]: unrecognized selector sent to instance 0x4c3c010'
    *** Call stack at first throw:
        0   CoreFoundation                      0x014285a9 __exceptionPreprocess + 185
        1   libobjc.A.dylib                     0x0157c313 objc_exception_throw + 44
        2   CoreFoundation                      0x0142a0bb -[NSObject(NSObject) doesNotRecognizeSelector:] + 187
        3   CoreFoundation                      0x01399966 ___forwarding___ + 966
        4   CoreFoundation                      0x01399522 _CF_forwarding_prep_0 + 50
        5   UIKit                               0x003aa0f4 forwardMethod2 + 92
        6   UIKit                               0x003aa0f4 forwardMethod2 + 92
        7   UIKit                               0x003aa0f4 forwardMethod2 + 92
        8   TMO                                 0x00006df6 -[UIView(__TapHook) __touchesEnded:withEvent:] + 51
        9   UIKit                               0x0056f4de _UIGestureRecognizerSortAndSendDelayedTouches + 3609
        10  UIKit                               0x0056fc53 _UIGestureRecognizerUpdateObserver + 927
        11  CoreFoundation                      0x0140989b __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 27
        12  CoreFoundation                      0x0139e6e7 __CFRunLoopDoObservers + 295
        13  CoreFoundation                      0x013671d7 __CFRunLoopRun + 1575
        14  CoreFoundation                      0x01366840 CFRunLoopRunSpecific + 208
        15  CoreFoundation                      0x01366761 CFRunLoopRunInMode + 97
        16  GraphicsServices                    0x019971c4 GSEventRunModal + 217
        17  GraphicsServices                    0x01997289 GSEventRun + 115
        18  UIKit                               0x002eac93 UIApplicationMain + 1160
        19  TMO                                 0x000024fc main + 102
        20  TMO                                 0x0000248d start + 53
    terminate called after throwing an instance of 'NSException'
    Any help or direction will not go unappreciated I've scoured the web and this forum for an answer I can understand.  I did get bits of code and explanations regarding using:
        UIViewController *moreViewController = tabBarController.moreNavigationController.topViewController;
        UITableView *moreTableView = (UITableView*)moreViewController.view;
    But, it's wasn't enough me to understand how to piece it all together.
    Thanks,
    Amy

    Open Xcode, then click on 'Window', click on 'Organizer'.
    Then click on the Documentation icon.
    Seach for 'viewcontroller'.
    Read and study the documentation for the various flavors of viewcontrollers.
    Then try applying some of your newfound knowledge your code and see what happens.
    I've found that trying a few ideas based on what I've read about is the best way to learn.  Be prepared to make lots and lots of mistakes;  You'll learn something from each one.
    Above all, be patient.  This technology can't be learned in a day or a week or even a month.  It may take months before you have that 'aha!' moment.  Once you do, it will start making sense.

  • How to restore Firefox custom search bar

    I'm using Firefox 37.0.1 and for some reason my custom search bar is gone. It was there last time I was online and I don't think I did anything to remove it. I used to be able to change the search engine over to Youtube, Wikipedia, Amazon and what have you but now it only searches Google. I checked this page: https://support.mozilla.org/en-US/kb/use-search-bar-firefox-and-manage-search-engines#w_hide-search-engines
    but it didn't help. Does anyone know how to get it back? I think I need to do something with the about:config page but I don't want to mess with that without asking someone who knows what they're doing first (read: not me XD). I've added a screenshot of what my search bar looks like now.
    Thanks

    Try the following and see if it works:
    Click on the menu icon (three bars) in the top-right corner, and choose "customize". You should see the search bar somewhere in the window, and can drag it back to next to what is shown in the picture. The article [[Customize Firefox controls, buttons and toolbars|Customize Firefox controls, buttons and toolbars]] also has instructions one how to do this.

  • Custom Scroll Bar

    Hi,
    I want to implement a custom scroll bar which functions like the one in StartMenu->Programs option. Instead of a vertical scroll bar I want buttons at the top and botton of the frame and on mouse over of it I want to implement the vertical scroll bar functionality. Is there any way to do it in Java. Basically I have a panel where in I have added a JTree component. I want to implement these scroll bars in this panel.
    Thanks in advance.

    dynamic is the easiest go with that

  • Scroll over highlight function not working on custom nav bar links

    Hi - I've created a custom nav bar in iWeb (www.HollywoodRC.com). I have it set up so that the text highlights when scrolled over. This function works in iWeb but does not work on my published site in Safari; however, works in my published site on IE. Any ideas on how to get the scroll over highlight to work on my published safari site? All the links work properly.
    Thanks,
    Steve

    No. Things must have changed. I created a hyperlink with a non web safe font, LedgerD, added a drop shadow and published. I also put the same link in a shape. You can see them in this test page: Page-1 . The two items are image files but they do not contain the link text. Very strange. The hyperlink text can't be selected nor dragged to the desktop like other links, like the Click to Play links on the page, however.
    However, I don't know how IE will handle it. According to this IE emulator site, http://ipinfo.info/netrenderer/, IE can see the drop shadow. But it doesn't tell us how the links will work.

  • Using multiple UIWebView objects with a Tab Bar Controller.

    So, I'm pretty new to this cocoa touch language and seem to be hitting a road block.
    I have an application that will use a Tab Bar Controller as a navigation. Each tab will display a different UIWebView object that's been linked to their own URL's. I can't for the life of me figure out how to get past the first UIWebView. If they're all the same object, with the same name, how can I set a different url for each??
    I've been going nuts over this for the past few hours and can't find any documentation online so any help would be AMAZING. Thank you very much.
    Message was edited by: thenameisjesse

    If they're all the same object, with the same name, how can I set a different url for each??
    They're not the same object. You alloc and setup each UIWebView independently.
    UIWebView is just a view so set it up the same way you would if you had a tabbar with multiple views.
    The default template has 2 views as I recall. Change the UIViews to UIWebView. As you switch them in set the URL and have it load.

  • Is it mandatory to have a tap-bar in banking application?

    while making a banking application for an iPhone device, Is it mandatory to have a tap-bar in it ?

    Master data reporting - such as reporting on top of 0EMPLOYEE.
    Such as Employee list - with address, organizational assignment, Birthday report and so on.
    Tomer.

  • Custom Tool Bar in Adobe

    Hi all,
    We have an requirement where in we have to provide a tool bar to the end user to edit the PDF at run time. The user should be able to select elements from the tool bar to add to the form. Is it possible through ALD?? or is there any other ADOBE tool through which we can acheive this?
    The user's have been using a Standard Template in MS Word till now, in which custom tool bar was created with Visual Basic Macros, which embeds things in doc file, which become place holders for SAP Data. They can freely edit the doc file to keep or delete what they want as per their requirement.
    Can we acheive a simmilar requirement in Adobe?
    We have to create such a standard template in PDF.
    I tried with ALD 8.0, but i guess we cannot add a  custom tool bar with it.
    Regards,
    Runal

    Hi,
    As of my knowledge on SAP IFBA custom toolbars or tabs or Upload(in online IFBA i.e. through webdynpro ABAP) functionalities are not supported. If your requirement demands to design these kind of forms then on your own you need to have a work arround. If you design these kind of forms then the performance of the adobe forms get decreases.
    If you find any workaround to these functionalities it will be nice if you present them in a Blog.
    Regards
    Pradeep Goli

  • Problem with tab bar controller!

    I'm fairly new to xcode (and programming for that matter) so please bear with me!
    I'm creating a utilities app and would like to put tabs on the flipside view controller. a normal push segue to a tab bar controller from the flipside doesn't seem to do the job when I run it.
    I'm not sure if I need to put a tab bar on the flipside view controller itself and connect it using coding? If so, how? Or is there another solution?
    Thanks in advance!

    I have an application based on the Tab Bar template as well, yet mine works. I also have views created via IB for each tab, but there are a series of connections which need to be made for the viewDidLoad method to be called. I made some notes along the way, perhaps they are helpful.
    In these notes, what I did was create the Tab Bar project, but I didn't like the way the views were set up, so I created a series of new views, added them the way I preferred (all from files, all the same view, including the first view), and then deleted the two default views.
    - Create a Tab Bar project.
    - With XCode, create a new UIViewController for the new first view, save it, add it to the project.
    - In IB, create a new view, save it, and add it to the project.
    - In the new view's File's Owner, set the class to the new view controller.
    - Connect the view outlet to the new view created.
    - Go to the tab bar control in the MainWindow.xib and create a new view controller.
    - Select the new tab button, and type in tab name and xib filename (without the extension).
    - Compile and run. With a label in the new view, it is easy to see if it works.
    Let me know if you find the problem.

  • Persist Customized Tab Bar

    Hi there, i have been all around the web for this, but i just cannot find a solution that works...
    I am currently using storyboards in xcode and I´m working on a project using tab bars. I have over 5 tabs atm and i therefore get the more button, and the user will also be enabled to customize the tab bar order. What I´m windering about is: How do i make the user-customized tab bar order to save when the application terminates. So when the application launches again, the tab bar would be just as the user left it.
    As I have said, I have been all around the web for this one. Most of the explenations on this problem are really old, 2008 - 2009. It would be really awsome if someone out there really could explain how to do this, and actually explain where to type in the different code.
    Cheers

    Tabs relate to the web pages. It is not logical for the tabs to include the address bar and toolbars. This is another example of the triumph of form over function. It should not be necessary to install plugins or fiddle with styles to make Firefox useable.
    Have you noticed how it seems to be morphing into Chrome?

  • Created a custom button bar and pull-down menus are missing

    created a custom button bar and pull-down menus are missing.
    I want pull-down menus of 'action', 'edit', 'query', 'block','record', 'field', 'window' and 'help' to display.
    What property setting or other item do I need to change?
    Thank you for your help.

    You could try this, I haven't used it before so I'm not sure if it's what you're looking for but it's worth a shot if you can't get anything else to work.
    http://web.mac.com/ijasonwhite/iwebunlimited/TipsBlog/Entries/2008/12/29_Drop_Down_Navigation_iniWeb.html
    Hope this helps!
    Josh

Maybe you are looking for