How do I create a view(Shows balance) that stays onscreen while I switch between tabs? [duplicate]

StackOverflow https://stackoverflow.com/questions/9289785

문제

Possible Duplicate:
How do I create a view that stays onscreen while I switch between tabs?

i have a tab bar conttoller, i wanted to create a view(it dispalys balance). I wanted that view to be displayed on top through out my application. How can create such a view???

도움이 되었습니까?

해결책

this way, you have to put the tabbar inside a view first (you should start with a plain view project or other project except for tabbar project)

so what u want to do is

  1. start with a plain view project (my choice)
  2. in header, put tabbardelegate
  3. in header, create TabBarController variable (for instead : myTabBar)
  4. populate the myTabBar in the implementation file
  5. add the myTabBar to the view by using [self.view addSubView:myTabBar.view]
  6. after you added the tabbar as a subview, proceed into making your new view (the one with balance)
  7. add the new view as a subview of the main parent view

this way, the balance view will place above the tabbar view, meaning, it will always be displayed above the tabBar

its quite simple, really, if u have rather complex codes, you can always insert the subview by index such as :

[self.view insertSubview:theView atIndex:theIndex]

or

[self.view insertSubview:balanceView aboveSubview:myTabBar.view]
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top