`
hx.19890101
  • 浏览: 109205 次
  • 性别: Icon_minigender_1
  • 来自: 北京
社区版块
存档分类
最新评论

在Tag Bar中使用Navgation

    博客分类:
  • ios
阅读更多
前面分别学到了Tag Bar和Navigation的使用,这次我们把他合起来使用,效果如下图





首先创建项目,选择window based application。项目名称为Nav_Tagbar。在.h中完成代码
#import <UIKit/UIKit.h>
@interface Nav_TagbarAppDelegate : NSObject <UIApplicationDelegate> {
    UIWindow *window;
	UITabBarController *rootController;
}
@property (nonatomic, retain) IBOutlet UIWindow *window;
@property (nonatomic, retain) IBOutlet UITabBarController *rootController;
@end

在.m中完成代码
#import "Nav_TagbarAppDelegate.h"
@implementation Nav_TagbarAppDelegate
@synthesize window;
@synthesize rootController;
#pragma mark -
#pragma mark Application lifecycle
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {    
    [window addSubview:rootController.view];
    [window makeKeyAndVisible];
    return YES;
}
- (void)dealloc {
	[rootController release];
    [window release];
    [super dealloc];
}
@end

再创建三个类,名为navView,secondView,thirdView,并生成视图。下面进行页面设计。双击MainWindow.xib,首先将一个Tag Bar Controller拖入nib主窗口中,按住Ctrl将Nav Tagbar App Delegate拖入Tag Bar Controller。之后将一个Navigation Controller拖入Tag Bar Controller中,如图

再做好相对界面的视图和控制器选择。这是nav的选择




在navView.xib中生成一个按钮,实现入栈跳转。在相应的.h.m文件中实现如下代码
#import <UIKit/UIKit.h>
@interface navView : UIViewController {
}
-(IBAction)buttonPressed;
@end

#import "navView.h"
#import "thirdView.h"
@implementation navView
-(IBAction)buttonPressed{
	thirdView *mythirdView = [[thirdView alloc] initWithNibName:@"thirdView" bundle:nil];
	[self.navigationController pushViewController:mythirdView animated:YES];
	[mythirdView release];
}
  • 大小: 59.1 KB
  • 大小: 35.6 KB
  • 大小: 78.1 KB
  • 大小: 30.9 KB
  • 大小: 17.7 KB
  • 大小: 20.4 KB
分享到:
评论

相关推荐

    Alphabetical Navigation Bar Display Tag-开源

    字母导航栏Java显示标签库, 通过将存储在java.util.List对象中的字符串数据切片和切成26个按字母顺序排列的子列表,创建了一个字母导航栏。

    Bootstrap 4 responsive web design

    Fixing the list navigation bar pseudo-classes 121 You deserve a badge! 122 Fixing some issues with the navigation bar 123 Do a grid again 127 Playing the cards 127 Learning cards in Bootstrap 4 128 ...

    FishEye:摄影师可访问的平台

    ○ By clicking on a tag in the navigation bar, the list of photographers is filtered to display only those who match this tag. ○ When the user clicks on a photographer's thumbnail, they are taken to ...

    android 可移动控件

    }else if(Y -_yDelta &gt; screenHeight - height-NavigationBarheight){ lParams.topMargin = screenHeight - height-NavigationBarheight; }else{ lParams.topMargin = Y - _yDelta; } lParams.rightMargin = -...

    WordPress 2.8 Theme Design.pdf

    The search bar ID 156 Classes output by the media manager 157 Classes output by the sidebar widgets 159 Classes output by the wp_list_pages template tag 160 Classes output by the wp_list_...

    visual assist 1709 破解

    Fixed issue in which a suggestion list failed to appear after typing the new keyword in C# when Options | Text Editor | C# | IntelliSense | Committed by pressing the space bar was enabled. (case=310) ...

    JCreatorV4

    You can float the Menu Bar in Full Screen mode, so you can still access the Menu Bar in Full Screen mode. JCreator has a file splitter tool which divides classes from one file into separate files. To ...

    Android实现3D云标签效果

    RelativeLayout navigation_bar; TextView mTextView1; private final float TOUCH_SCALE_FACTOR = .8f; private float tspeed; private TagCloud mTagCloud; private float mAngleX =0; private flo

    sliding-nav:滑动效果的导航菜单

    Use class name sliding-nav in a navigation bar element,and use .active for a selected menu item. Use following attributes to change its color,radius and height:sn-color, sn-radius,sn-height. (if no ...

    CodeLobster.PHP.Edition.Pro.4.3.2

    Autocomplete of tags, attributes for current tag, closing tags. • HTML code inspector Inspector makes it simple to find HTML elements buried deep in the page. • CSS autocomplete Autocomplete of ...

    CodeLobster_PHP_Edition_Pro_4.1.0

    Autocomplete of tags, attributes for current tag, closing tags. • HTML code inspector Inspector makes it simple to find HTML elements buried deep in the page. • CSS autocomplete Autocomplete of ...

    CodeLobster PHP Edition Pro 4.0.1

    Autocomplete of tags, attributes for current tag, closing tags. • HTML code inspector Inspector makes it simple to find HTML elements buried deep in the page. • CSS autocomplete Autocomplete of ...

    Visual C++ 编程资源大全(英文源码 其它)

    21.zip Inverting Assignment Operations 转化操作任务(5KB)&lt;END&gt;&lt;br&gt;22,22.zip VC4.2 style keyboard macro recorder for DevStudio 97 在DevStudio 97中使用在VC4.2风格的键盘宏记录(4KB)&lt;END&gt;&lt;br&gt;23,...

    Dreamweaver8_getting_started

    Format the navigation bar text . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .114 (Optional) Center the contents of the page . . . . . . . . . . . . . . . . . . . . . . 125 Chapter...

    VB编程资源大全(英文源码 网络)

    1 , WinLocaleConvert.zip This program shows the international settings of the country you select such as Format Currency, Date Format, Day Name, Month Name...&lt;END&gt;&lt;br&gt;2 , netstuff.zip This ...

Global site tag (gtag.js) - Google Analytics