Search Results

Search found 36 results on 2 pages for 'uitabbaritem'.

Page 2/2 | < Previous Page | 1 2 

  • Re-Add tabBarController's view into window and the device is in landscape mode

    - by user285553
    Hello, I have an app that is a tabBarController based app. I have 4 tabs on it and one of these is for logging in/out in my app. The main ideea is that when I logout, I release the tabBarController (this will release the all 4 view controllers too - I have done this becuse I want to refersh all the views after logging out to look just like the first time).After this, I alloc it again and add the view controllers aagin,set the tabBarItem's titles,etc.This work ok. The problem is when I am in landscape mode;my logout view is painted to fit the landscape area,but after disconnect(now I releasse and alloc again the tabbarController) the view is painted in portrait mode but my device is in lanscape. After disconnected, I call the releaseOldTabView and the createNewTabView.After this tabBarController is in portrait insead of landscape. -(void)releaseOldTabView:(BOOL)tabViewEnabled{ if(tabViewEnabled){ [tabBarController.view removeFromSuperview]; [tabBarController release]; } } -(void)createNewTabView{ tabBarController = [[UITabBarController alloc] init]; NSMutableArray *oneArray = [[NSMutableArray alloc] init]; tabBarController.delegate = self; LoginViewController *login= [[LoginViewController2 alloc] initWithNibName:@"LoginViewController" bundle:nil]; SecondViewController *secondController = [[SecondViewController alloc] initWithNibName:@"SecondViewController" bundle:nil]; ThirdViewController *thirdController = [[ThirdViewController alloc] init]; FourthViewController *fourthController = [[FourthViewController alloc] init]; login.tabBarItem = [[UITabBarItem alloc] initWithTitle:@"Login" image:[UIImage imageNamed:@"connect.png"] tag:0]; secondController.tabBarItem = [[UITabBarItem alloc] initWithTitle:@"TabBar2" image:[UIImage imageNamed:@"tabBar2.png"] tag:1]; thirdController.tabBarItem = [[UITabBarItem alloc] initWithTitle:@"TabBar3" image:[UIImage imageNamed:@"tabBar3.png"] tag:2]; fourthController.tabBarItem = [[UITabBarItem alloc] initWithTitle:@"TabBar4" image:[UIImage imageNamed:@"tabBar4.png"] tag:3]; [oneArray addObject:login]; [oneArray addObject:secondController]; [oneArray addObject:thirdController]; [oneArray addObject:fourthController]; [tabBarController setViewControllers:oneArray]; //[tabBarController.view convertRect:tabBarController.view.frame toView:window]; [window addSubview:tabBarController.view]; [oneArray release]; [login release]; [secondController release]; [thirdController release]; [fourthController release]; } After calling this method, the tabbar view is in portrait,but statusBar(the top bar which says the carrier name) is painted normally(landscape). I also tried the [tabBarController.view convertRect:tabBarController.view.frame toView:window]; but without any succes. Can anyone give a hand of help? Thanks in advance, Alex.

    Read the article

  • iPhone SDK - UITabBarConroller and custom design

    - by Cheryl
    Hi I am having a problem with my tab bars at the bottom of the screen. The designer has decided it should be one colour (not black) when inactive and another colour when active. I have worked out how to replace the main colour of the tabbar by subclassing UITabBarController and doing this:- - (void)viewDidLoad { [super viewDidLoad]; CGRect frame = CGRectMake(0.0, 0, self.view.bounds.size.width, self.view.bounds.size.height); UIView *v = [[UIView alloc] initWithFrame:frame]; //get percentage values from digitalcolour meter and enter as decimals v.backgroundColor = [UIColor colorWithRed:.0 green:.706 blue:.863 alpha:1]; [tabBar1 insertSubview:v atIndex:0]; [v release]; } I just can't see how to make the active tabbar be a separate colour when it is selected. I have tried subclassing UITabBarItem but there doesn't seem to be any property for me to set to change the background colour of the tab. They also want to have the icons on the tab bar not be blue and grey and I can't figure out how to do that. In the ViewController for one tab bar item I have put this into viewdidload:- myTabBarItem *tabItem = [[myTabBarItem alloc] initWithTitle:@"listOOO" image:[UIImage imageNamed:@"starcopy.png"] tag:1]; tabItem.customHighlightedImage=[UIImage imageNamed:@"starcopy.png"]; self.tabBarItem=tabItem; [tabItem release]; tabItem=nil; and in my subclass of UITabBarItem I have put this:- -(UIImage *) selectedImage{ return self.customHighlightedImage; } Only I don't see the icon at all. If I put this into the viewDidLoad of my subclass of UITabBarController:- for (UITabBarItem *item in tabBar1.items){ item.image = [UIImage imageNamed:@"starcopy.png"]; } Then all my tab bars have the icon but they are blue (and grey when inactive) how would I get them not to become blue but stay their original colour? If you have any light on this problem please help as I have been banking my head on the wall for 2 days now and it's getting me down. Thanks in advance Cheryl

    Read the article

  • how to change UITabbar selected color?

    - by RAGOpoR
    according to this post for now, Is apple will also reject this code? and how to implement what apple will approve? @interface UITabBar (ColorExtensions) - (void)recolorItemsWithColor:(UIColor *)color shadowColor:(UIColor *)shadowColor shadowOffset:(CGSize)shadowOffset shadowBlur:(CGFloat)shadowBlur; @end @interface UITabBarItem (Private) @property(retain, nonatomic) UIImage *selectedImage; - (void)_updateView; @end @implementation UITabBar (ColorExtensions) - (void)recolorItemsWithColor:(UIColor *)color shadowColor:(UIColor *)shadowColor shadowOffset:(CGSize)shadowOffset shadowBlur:(CGFloat)shadowBlur { CGColorRef cgColor = [color CGColor]; CGColorRef cgShadowColor = [shadowColor CGColor]; for (UITabBarItem *item in [self items]) if ([item respondsToSelector:@selector(selectedImage)] && [item respondsToSelector:@selector(setSelectedImage:)] && [item respondsToSelector:@selector(_updateView)]) { CGRect contextRect; contextRect.origin.x = 0.0f; contextRect.origin.y = 0.0f; contextRect.size = [[item selectedImage] size]; // Retrieve source image and begin image context UIImage *itemImage = [item image]; CGSize itemImageSize = [itemImage size]; CGPoint itemImagePosition; itemImagePosition.x = ceilf((contextRect.size.width - itemImageSize.width) / 2); itemImagePosition.y = ceilf((contextRect.size.height - itemImageSize.height) / 2); UIGraphicsBeginImageContext(contextRect.size); CGContextRef c = UIGraphicsGetCurrentContext(); // Setup shadow CGContextSetShadowWithColor(c, shadowOffset, shadowBlur, cgShadowColor); // Setup transparency layer and clip to mask CGContextBeginTransparencyLayer(c, NULL); CGContextScaleCTM(c, 1.0, -1.0); CGContextClipToMask(c, CGRectMake(itemImagePosition.x, -itemImagePosition.y, itemImageSize.width, -itemImageSize.height), [itemImage CGImage]); // Fill and end the transparency layer CGContextSetFillColorWithColor(c, cgColor); contextRect.size.height = -contextRect.size.height; CGContextFillRect(c, contextRect); CGContextEndTransparencyLayer(c); // Set selected image and end context [item setSelectedImage:UIGraphicsGetImageFromCurrentImageContext()]; UIGraphicsEndImageContext(); // Update the view [item _updateView]; } } @end

    Read the article

  • Remove Bagde from tabbar item.

    - by japs
    Hello All, How to Remove Badge from the tabbar item i had use below code but not working for me. UITabBarItem *chatbadge=[appDelegate.tabBarController.tabBar.items objectAtIndex:2]; chatbadge.badgeValue=nil; Suggest any Solution.

    Read the article

  • Initial selected Item in an UITabBar without a UITabBarController

    - by juan.xavier
    Hello, How do I set the default selected UITabBarItem in an UITabBar that is within an UIView, not an UITabBarController? Just to clarify, the UIView does implement the protocol and the didSelectItem method works. At run-time, the tabbar works and the tabbaritems selected when the user touches them. My problem is setting the default selected item. If i use [myTabbar setSelectedItem] within the didSelectItem method it works. But outside of it, it doesn't (for example, in the viewDidLoad method of my UIView). Thanks!

    Read the article

  • iPhone:Tabbar item actions are not happening

    - by user187532
    Hello all, I created a window application, which has a tabbar controller with four tabbar items. Each tabbar items are linked with a tableview. I have also set Navigation bar for each tabbar items. I have appdelegate file, which calls the first tableview controller of which is set for first tabbar item. I am trying to retrieve and do an action whenever a tabbar item is clicked. For that, i tried to add "- (void)tabBar:(UITabBar *)tabBar didSelectItem:(UITabBarItem *)item" and "- (void)tabBarController:(UITabBarController *)tabBarController didSelectViewController:(UITableViewController *)viewController" in my first tableview controller, but it is not at all responding whenever i click any tabbar items. My question is, if i create a window based application and added tabbar controller, tableview and navigation bar in .XIB file, is it not possible to access and do an action programatically whenever a tabbar item is clicked? (or) Am i doing anything wrong? Please help me to resolve this and share your ideas. Thanks.

    Read the article

  • custom tabbars and make them circulate

    - by pengwang
    i want to custom tabbars and want to circulate slide,default tab bar only have 5 items show at the same time,it not meet me,i have 11 items,so i want to make 3 tabbars ,every have 5 items,for example A(0-4)--B(5-9)--C(10)--A--B--C--A. at print i only finish A(0-4)--B(5-9)--C(10),how to make them circulate? my code : .h file #import <UIKit/UIKit.h> @protocol InfiniTabBarDelegate; @interface InfiniTabBar : UIScrollView <UIScrollViewDelegate, UITabBarDelegate> { __weak id <InfiniTabBarDelegate> infiniTabBarDelegate; NSMutableArray *tabBars; UITabBar *aTabBar; UITabBar *bTabBar; } @property (nonatomic, weak) id infiniTabBarDelegate; @property (strong,nonatomic) NSMutableArray *tabBars; @property (strong,nonatomic) UITabBar *aTabBar; @property (strong,nonatomic) UITabBar *bTabBar; - (id)initWithItems:(NSArray *)items; - (void)setBounces:(BOOL)bounces; // Don't set more items than initially - (void)setItems:(NSArray *)items animated:(BOOL)animated; - (int)currentTabBarTag; - (int)selectedItemTag; - (BOOL)scrollToTabBarWithTag:(int)tag animated:(BOOL)animated; - (BOOL)selectItemWithTag:(int)tag; @end @protocol InfiniTabBarDelegate <NSObject> - (void)infiniTabBar:(InfiniTabBar *)tabBar didScrollToTabBarWithTag:(int)tag; - (void)infiniTabBar:(InfiniTabBar *)tabBar didSelectItemWithTag:(int)tag; @end .m file @implementation InfiniTabBar @synthesize infiniTabBarDelegate; @synthesize tabBars; @synthesize aTabBar; @synthesize bTabBar; - (id)initWithItems:(NSArray *)items { self = [super initWithFrame:CGRectMake(0.0, 411.0, 320.0, 49.0)]; // TODO: //self = [super initWithFrame:CGRectMake(self.superview.frame.origin.x + self.superview.frame.size.width - 320.0, self.superview.frame.origin.y + self.superview.frame.size.height - 49.0, 320.0, 49.0)]; // Doesn't work. self is nil at this point. if (self) { self.pagingEnabled = YES; self.delegate = self; self.tabBars = [[NSMutableArray alloc] init]; float x = 0.0; for (double d = 0; d < ceil(items.count / 5.0); d ++) { UITabBar *tabBar = [[UITabBar alloc] initWithFrame:CGRectMake(x, 0.0, 320.0, 49.0)]; tabBar.delegate = self; int len = 0; for (int i = d * 5; i < d * 5 + 5; i ++) if (i < items.count) len ++; tabBar.items = [items objectsAtIndexes:[NSIndexSet indexSetWithIndexesInRange:NSMakeRange(d * 5, len)]]; // NSLog(@"####%@",NSMakeRange(d * 5, len)); [self.tabBars addObject:tabBar]; [self addSubview:tabBar]; x += 320.0; } self.contentSize = CGSizeMake(x, 49.0); } return self; } - (void)setBounces:(BOOL)bounces { if (bounces) { int count = self.tabBars.count; if (count > 0) { if (self.aTabBar == nil) self.aTabBar = [[UITabBar alloc] initWithFrame:CGRectMake(-320.0, 0.0, 320.0, 49.0)]; [self addSubview:self.aTabBar]; if (self.bTabBar == nil) self.bTabBar = [[UITabBar alloc] initWithFrame:CGRectMake(count * 320.0, 0.0, 320.0, 49.0)]; [self addSubview:self.bTabBar]; } } else { [self.aTabBar removeFromSuperview]; [self.bTabBar removeFromSuperview]; } [super setBounces:bounces]; } - (void)setItems:(NSArray *)items animated:(BOOL)animated { for (UITabBar *tabBar in self.tabBars) { int len = 0; for (int i = [self.tabBars indexOfObject:tabBar] * 5; i < [self.tabBars indexOfObject:tabBar] * 5 + 5; i ++) if (i < items.count) len ++; [tabBar setItems:[items objectsAtIndexes:[NSIndexSet indexSetWithIndexesInRange:NSMakeRange([self.tabBars indexOfObject:tabBar] * 5, len)]] animated:animated]; } self.contentSize = CGSizeMake(ceil(items.count / 5.0) * 320.0, 49.0); } - (int)currentTabBarTag { return self.contentOffset.x / 320.0; } - (int)selectedItemTag { for (UITabBar *tabBar in self.tabBars) if (tabBar.selectedItem != nil) return tabBar.selectedItem.tag; // No item selected return 0; } - (BOOL)scrollToTabBarWithTag:(int)tag animated:(BOOL)animated { for (UITabBar *tabBar in self.tabBars) if ([self.tabBars indexOfObject:tabBar] == tag) { UITabBar *tabBar = [self.tabBars objectAtIndex:tag]; [self scrollRectToVisible:tabBar.frame animated:animated]; if (animated == NO) [self scrollViewDidEndDecelerating:self]; return YES; } return NO; } - (BOOL)selectItemWithTag:(int)tag { for (UITabBar *tabBar in self.tabBars) for (UITabBarItem *item in tabBar.items) if (item.tag == tag) { tabBar.selectedItem = item; [self tabBar:tabBar didSelectItem:item]; return YES; } return NO; } - (void)scrollViewDidEndDecelerating:(UIScrollView *)scrollView { [infiniTabBarDelegate infiniTabBar:self didScrollToTabBarWithTag:scrollView.contentOffset.x / 320.0]; } - (void)scrollViewDidEndScrollingAnimation:(UIScrollView *)scrollView { [self scrollViewDidEndDecelerating:scrollView]; } - (void)tabBar:(UITabBar *)cTabBar didSelectItem:(UITabBarItem *)item { // Act like a single tab bar for (UITabBar *tabBar in self.tabBars) if (tabBar != cTabBar) tabBar.selectedItem = nil; [infiniTabBarDelegate infiniTabBar:self didSelectItemWithTag:item.tag]; } @end

    Read the article

  • Pass a class as a parameter?

    - by JuBu1324
    I have been lead to believe that it is possible to pass a class as a method parameter, but I'm having trouble implementing the concept. Right now I have something like: - (id)navControllerFromView:(Class *)viewControllerClass title:(NSString *)title imageName:(NSString *)imageName { viewControllerClass *viewController = [[viewControllerClass alloc] init]; UINavigationController *thisNavController = [[UINavigationController alloc] initWithRootViewController: viewController]; thisNavController.tabBarItem = [[UITabBarItem alloc] initWithTitle: title image: [UIImage imageNamed: imageName] tag: 3]; return thisNavController; } and I call it like this: rootNavController = [ self navControllerFromView:RootViewController title:@"Contact" imageName:@"my_info.png" ]; What's wrong with this picture?

    Read the article

  • iPhone:(Three20)Unselect (Unhiglight) TTTabItem dynamically?

    - by user187532
    Hello friends, I have four TabBarItem (TTTabItem) in a TabBar (TTTabBar). In one case, i want to remove the TabBarItem selection from any of the four TabBarItems (TTTabItem) . i.e., the complete TabBar will not show any TabBarItems selected. Can i achieve it? I tried the following, [_tabBar1 setSelectedTabItem:nil]; But it is crashing. Could someone guide me to resolve this? I need help urgently. (OR) If we clicked on one TabBarItem(TTTabItem), then again clicking on same TabBarItem(TTTabItem) will not call/execute anything right. Can i make it always clicking on a TabBarItem, should call "(void)tabBar: (UITabBar *)tabBar didSelectItem:(UITabBarItem *)item" (or) any other relevant system functions? I need your helps urgently, could someone guide me for my issue? Thank you.

    Read the article

  • What constitutes a private API in an iPhone app?

    - by tweened
    I'm fairly new to Objective-C and am confused on what falls under the unbrella of a "private API" that could cause Apple to reject my app. Does this include adding methods to existing classes? For example, I found some code on stackoverflow to recolor the tab bar icons for UITabBars with this extension to the UITabBarItem class. Is this considered a "private API"? If not, what does? @interface UITabBar (ColorExtensions) - (void)recolorItemsWithImage:(UIImage *)image shadowColor:(UIColor *)shadowColor shadowOffset:(CGSize)shadowOffset shadowBlur:(CGFloat)shadowBlur; @end

    Read the article

  • How to add Image On 'more' Button of UITabBarController in iOS 6?

    - by iPatel
    I know That How to add UITabBarController and how it used, I already done it. My Problem is only that I am no able to add image on 'more' button of UITabBarController. I know There are may Question That Similar to my Question but no one can help me. After googling I found that we can't add images on 'More' button in UITabBarController Because more button is autometically displayed by UITabBarController when UITabBarItem more Then 5. I also find that how to change SELECTION COLOR AND TITLE OF 'more' Button But I can not find abut 'more' button Image. So may be i need to Custom UITabBarController so, I also searching for any Custom UITabBarController but also I can not find it. Please help me on this Issue.

    Read the article

< Previous Page | 1 2