UITabBarController是IOS中很常用的一个viewController,例如系统的闹钟程序,ipod 程序等。UITabBarController通常作为整个程序的rootViewController,而且不能添加到别的container viewController中。

  首先我们看一下它的view层级图:

一、手动创建UITabBarController

  最常见的创建UITabBarController的地方就是在application delegate中的 applicationDidFinishLaunching:方法,因为UITabBarController通常是作为整个程序的rootViewController的,我们需要在程序的window显示之前就创建好它,具体步骤如下:

  1、创建一个UITabBarController对象

  2、创建tabbarcontroller中每一个tab对应的要显示的对象

  3、通过UITabBarController的viewController属性将要显示的所有content viewcontroller添加到UITabBarController中

  4、通过设置UITabBarController对象为window.rootViewController,然后显示window

  下面看一个简单的例子:

 
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
self.window = [[[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]] autorelease];
// Override point for customization after application launch.

   SvTabBarFirstViewController *viewController1, *viewController2;
viewController1 = [[SvTabBarFirstViewController alloc] initWithNibName:nil bundle:nil];
viewController1.title = @"First"; viewController2 = [[SvTabBarFirstViewController alloc] initWithNibName:nil bundle:nil];
viewController2.title = @"Second"; self.tabBarController = [[[UITabBarController alloc] init] autorelease];
self.tabBarController.delegate = self;
self.tabBarController.viewControllers = [NSArray arrayWithObjects:viewController1, viewController2, nil];
[viewController1 release];
[viewController2 release]; self.window.rootViewController = self.tabBarController;
[self.window makeKeyAndVisible]; return YES;
}
 

二、UITabBarItem

  UITabBar上面显示的每一个Tab都对应着一个ViewController,我们可以通过设置viewcontroller.tabBarItem属性来改变tabbar上对应的tab显示内容。否则系统将会根据viewController的title自动创建一个,该tabBarItem只显示文字,没有图像。当我们自己创建UITabBarItem的时候,我们可以显示的指定显示的图像和对应的文字描述。当然还可以通过setFinishedSelectedImage:withFinishedUnselectedImage:方法给选中状态和飞选中状态指定不同的图片。下面看个自己创建UITabBarItem的小例子:

UITabBarItem *item = [[UITabBarItem alloc] initWithTitle:@"Second" image:nil tag:2];
[item setFinishedSelectedImage:[UIImage imageNamed:@"second.png"]
withFinishedUnselectedImage:[UIImage imageNamed:@"first.png"]];
viewController2.tabBarItem = item;
[item release];

  此外UITabBarItem还有一个属性badgeValue,通过设置该属性可以在其右上角显示一个小的角标,通常用于提示用户有新的消息,使用很简单,后面有例子。

三、moreNavigationController

  UITabBar上最多可以显示5个Tab,当我们往UITabBarController中添加超过的viewController超过5个时候,最后一个一个就会自动变成,按照设置的viewControlles的顺序,显示前四个viewController的tabBarItem,后面的tabBarItem将不再显示。当点击more时候将会弹出一个标准的navigationViewController,里面放有其它未显示的的viewController,并且带有一个edit按钮,通过点击该按钮可以进入类似与ipod程序中设置tabBar的编辑界面。编辑界面中默认所有的viewController都是可以编辑的,我们可以通过设置UITabBarController的customizableViewControllers属性来指定viewControllers的一个子集,即只允许一部分viewController是可以放到tabBar中显示的。但是这块儿要注意一个问题就是每当UITabBarController的viewControllers属性发生变化的时候,customizableViewControllers就会自动设置成跟viewControllers一致,即默认的所有的viewController都是可以编辑的,如果我们要始终限制只是某一部分可编辑的话,记得在每次viewControlles发生改变的时候,重新设置一次customizableViewControllers。

  

四、UITabBarController的Rotation

  UITabBarController默认只支持竖屏,当设备方向放生变化时候,它会查询viewControllers中包含的所有ViewController,仅当所有的viewController都支持该方向时,UITabBarController才会发生旋转,否则默认的竖向。

  此处需要注意当UITabBarController支持旋转,而且发生旋转的时候,只有当前显示的viewController会接收到旋转的消息。

五、UITabBar

  UITabBar自己有一些方法是可以改变自身状态,但是对于UITabBarController自带的tabBar,我们不能直接去修改其状态。任何直接修改tabBar的操作将会抛出异常,下面看一个抛出异常的小例子:

 
self.tabBarController = [[[UITabBarController alloc] init] autorelease];
self.tabBarController.delegate = self;
self.tabBarController.viewControllers = [NSArray arrayWithObjects:viewController1, viewController2, viewController3, nil]; self.window.rootViewController = self.tabBarController;
[self.window makeKeyAndVisible]; self.tabBarController.tabBar.selectedItem = nil;
 

  上面代码的最后一行直接修改了tabBar的状态,运行程序回得到如下结果:

六、Change Selected Viewcontroller

  改变UITabBarController中当前显示的viewController,可以通过一下两种方法:

  1、selectedIndex属性

  通过该属性可以获得当前选中的viewController,设置该属性,可以显示viewControllers中对应的index的viewController。如果当前选中的是MoreViewController的话,该属性获取出来的值是NSNotFound,而且通过该属性也不能设置选中MoreViewController。设置index超出viewControllers的范围,将会被忽略。

  2、selectedViewController属性

  通过该属性可以获取到当前显示的viewController,通过设置该属性可以设置当前选中的viewController,同时更新selectedIndex。可以通过给该属性赋值

tabBarController.moreNavigationController可以选中moreViewController。

  3、viewControllers属性

  设置viewControllers属性也会影响当前选中的viewController,设置该属性时UITabBarController首先会清空所有旧的viewController,然后部署新的viewController,接着尝试重新选中上一次显示的viewController,如果该viewController已经不存在的话,会接着尝试选中index和selectedIndex相同的viewController,如果该index无效的话,则默认选中第一个viewController。

七、UITabBarControllerDelegate

  通过代理我们可以监测UITabBarController的当前选中viewController的变化,以及moreViewController中对编辑所有viewController的编辑。通过实现下面方法:

- (BOOL)tabBarController:(UITabBarController *)tabBarController shouldSelectViewController:(UIViewController *)viewController;

  该方法用于控制TabBarItem能不能选中,返回NO,将禁止用户点击某一个TabBarItem被选中。但是程序内部还是可以通过直接setSelectedIndex选中该TabBarItem。

  下面这三个方法主要用于监测对moreViewController中对view controller的edit操作

 
- (void)tabBarController:(UITabBarController *)tabBarController willBeginCustomizingViewControllers:(NSArray *)viewControllers;

- (void)tabBarController:(UITabBarController *)tabBarController willEndCustomizingViewControllers:(NSArray *)viewControllers changed:(BOOL)changed;

- (void)tabBarController:(UITabBarController *)tabBarController didEndCustomizingViewControllers:(NSArray *)viewControllers changed:(BOOL)changed;
 

  

七、附件UITabBarController测试程序源码

 

SvTabBarAppDelegate.h这个头文件,折叠后加进去,总是无法展开,望大家见谅!
 
//
// SvTabBarAppDelegate.h
// SvTabBarControllerSample
//
// Created by maple on 5/19/12.
// Copyright (c) 2012 smileEvday. All rights reserved.
// #import <UIKit/UIKit.h> @interface SvTabBarAppDelegate : UIResponder <UIApplicationDelegate, UITabBarControllerDelegate> @property (strong, nonatomic) UIWindow *window; @property (strong, nonatomic) UITabBarController *tabBarController; @end
 
 
//
// SvTabBarAppDelegate.m
// SvTabBarControllerSample
//
// Created by maple on 5/19/12.
// Copyright (c) 2012 smileEvday. All rights reserved.
// #import "SvTabBarAppDelegate.h" #import "SvTabBarFirstViewController.h"
#import "SvTabBarSecondViewController.h" @implementation SvTabBarAppDelegate @synthesize window = _window;
@synthesize tabBarController = _tabBarController; - (void)dealloc
{
[_window release];
[_tabBarController release];
[super dealloc];
} - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
self.window = [[[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]] autorelease];
// Override point for customization after application launch.
SvTabBarFirstViewController *viewController1, *viewController2, *viewController3;
SvTabBarFirstViewController *viewController4, *viewController5, *viewController6; // second kind tabbar controlle
SvTabBarSecondViewController *viewController7; // init first tabbarviewcontroller
viewController1 = [[SvTabBarFirstViewController alloc] initWithNibName:nil bundle:nil];
viewController1.title = @"First";
// here set text is in vain, because the vc's view is not load
//viewController1.contentLbl.text = @"First Tab"; UIButton *btn = [UIButton buttonWithType:UIButtonTypeRoundedRect];
btn.frame = CGRectMake(0, 0, 150, 70);
btn.center = CGPointMake(160, 120);
btn.autoresizingMask = UIViewAutoresizingFlexibleTopMargin | UIViewAutoresizingFlexibleBottomMargin;
[btn setTitle:@"Change to Third" forState:UIControlStateNormal];
[btn addTarget:self action:@selector(changToThirdTab) forControlEvents:UIControlEventTouchUpInside];
[viewController1.view addSubview:btn]; btn = [UIButton buttonWithType:UIButtonTypeRoundedRect];
btn.frame = CGRectMake(0, 0, 150, 70);
btn.center = CGPointMake(160, 240);
btn.autoresizingMask = UIViewAutoresizingFlexibleTopMargin | UIViewAutoresizingFlexibleBottomMargin;
[btn setTitle:@"Change to MoreVC" forState:UIControlStateNormal];
[btn addTarget:self action:@selector(changToMoreTab) forControlEvents:UIControlEventTouchUpInside];
[viewController1.view addSubview:btn]; btn = [UIButton buttonWithType:UIButtonTypeRoundedRect];
btn.frame = CGRectMake(0, 0, 150, 70);
btn.center = CGPointMake(160, 360);
btn.autoresizingMask = UIViewAutoresizingFlexibleTopMargin | UIViewAutoresizingFlexibleBottomMargin;
[btn setTitle:@"Set ViewController" forState:UIControlStateNormal];
[btn addTarget:self action:@selector(setTabBarViewController) forControlEvents:UIControlEventTouchUpInside];
[viewController1.view addSubview:btn]; viewController2 = [[SvTabBarFirstViewController alloc] initWithNibName:nil bundle:nil];
viewController2.title = @"Second";
btn = [UIButton buttonWithType:UIButtonTypeRoundedRect];
btn.frame = CGRectMake(0, 0, 150, 70);
btn.center = CGPointMake(160, 120);
btn.autoresizingMask = UIViewAutoresizingFlexibleTopMargin | UIViewAutoresizingFlexibleBottomMargin;
[btn setTitle:@"Change to Fourth" forState:UIControlStateNormal];
[btn addTarget:self action:@selector(changToFourthTab) forControlEvents:UIControlEventTouchUpInside];
[viewController2.view addSubview:btn]; btn = [UIButton buttonWithType:UIButtonTypeRoundedRect];
btn.frame = CGRectMake(0, 0, 150, 70);
btn.center = CGPointMake(160, 240);
btn.autoresizingMask = UIViewAutoresizingFlexibleTopMargin | UIViewAutoresizingFlexibleBottomMargin;
[btn setTitle:@"Set Badge" forState:UIControlStateNormal];
[btn addTarget:self action:@selector(setBadge) forControlEvents:UIControlEventTouchUpInside];
[viewController2.view addSubview:btn]; viewController3 = [[SvTabBarFirstViewController alloc] initWithNibName:nil bundle:nil];
viewController3.title = @"Third";
UITabBarItem *item = [[UITabBarItem alloc] initWithTitle:@"#3#" image:nil tag:2];
[item setFinishedSelectedImage:[UIImage imageNamed:@"second.png"]
withFinishedUnselectedImage:[UIImage imageNamed:@"first.png"]];
viewController3.tabBarItem = item;
[item release]; viewController4 = [[SvTabBarFirstViewController alloc] initWithNibName:nil bundle:nil];
viewController4.title = @"Fourth"; viewController5 = [[SvTabBarFirstViewController alloc] initWithNibName:nil bundle:nil];
viewController5.title = @"Fifth"; viewController6 = [[SvTabBarFirstViewController alloc] initWithNibName:nil bundle:nil];
viewController6.title = @"Sixth"; // only support portrait interface, so when you add this vc to tabBarcontroller,
// the tabbarcontroller will support portrait interface only
viewController7 = [[SvTabBarSecondViewController alloc] initWithNibName:nil bundle:nil]; self.tabBarController = [[[UITabBarController alloc] init] autorelease];
self.tabBarController.delegate = self;
self.tabBarController.viewControllers = [NSArray arrayWithObjects:viewController1, viewController2, viewController3,
viewController4, viewController5, viewController6, viewController7, nil];
self.tabBarController.customizableViewControllers = [NSArray arrayWithObjects:viewController1, viewController2, viewController3,
viewController4, nil]; [viewController1 release];
[viewController2 release];
[viewController3 release];
[viewController4 release];
[viewController5 release];
[viewController6 release];
[viewController7 release]; self.window.rootViewController = self.tabBarController;
[self.window makeKeyAndVisible]; // Directly modifying a tab bar managed by a tab bar controller is not allowed.
// self.tabBarController.tabBar.selectedItem = nil; return YES;
} - (void)applicationWillResignActive:(UIApplication *)application
{
// Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
// Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game.
} - (void)applicationDidEnterBackground:(UIApplication *)application
{
// Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
// If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
} - (void)applicationWillEnterForeground:(UIApplication *)application
{
// Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background.
} - (void)applicationDidBecomeActive:(UIApplication *)application
{
// Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
} - (void)applicationWillTerminate:(UIApplication *)application
{
// Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
} /*
// Optional UITabBarControllerDelegate method.
- (void)tabBarController:(UITabBarController *)tabBarController didSelectViewController:(UIViewController *)viewController
{
}
*/ /*
// Optional UITabBarControllerDelegate method.
- (void)tabBarController:(UITabBarController *)tabBarController didEndCustomizingViewControllers:(NSArray *)viewControllers changed:(BOOL)changed
{
}
*/ #pragma mark -
#pragma mark Btn action - (void)changToThirdTab
{
[self.tabBarController setSelectedViewController:[self.tabBarController.viewControllers objectAtIndex:2]];
} - (void)changToFourthTab
{
[self.tabBarController setSelectedIndex:3];
} // set tabbar viewcontrollers will lead customizableViewControllers set to default.(equal to viewcontrollers)
// so if you want to restrict customizableViewControllers, you should reset it when viewcontrollers changed
- (void)setTabBarViewController
{
self.tabBarController.viewControllers = self.tabBarController.viewControllers;
} // you can just select more tab by set selectedViewController, set selectedIndex is in vain
- (void)changToMoreTab
{
[self.tabBarController setSelectedViewController:self.tabBarController.moreNavigationController]; // when set more tab selected, the selectedindex will be NSNotFound
NSLog(@"%d", self.tabBarController.selectedIndex);
} - (void)setBadge
{
self.tabBarController.selectedViewController.tabBarItem.badgeValue = @"2";
} #pragma mark-
#pragma mark UITabBarcontrollerDelegate - (void)tabBarController:(UITabBarController *)tabBarController willBeginCustomizingViewControllers:(NSArray *)viewControllers
{
NSLog(@"willBeginCustomizingViewControllers: %@", viewControllers);
} - (void)tabBarController:(UITabBarController *)tabBarController willEndCustomizingViewControllers:(NSArray *)viewControllers changed:(BOOL)changed
{
NSLog(@"viewcontrollers: %@, ischanged: %d", viewControllers, changed);
} - (void)tabBarController:(UITabBarController *)tabBarController didEndCustomizingViewControllers:(NSArray *)viewControllers changed:(BOOL)changed
{
NSLog(@"didEndCustomizingViewController!");
NSLog(@"didEndCustomizingViewController: %@, ischanged: %d", viewControllers, changed);
} - (BOOL)tabBarController:(UITabBarController *)tabBarController shouldSelectViewController:(UIViewController *)viewController
{
if ([tabBarController.viewControllers indexOfObject:viewController] != 2) {
return YES;
}
return NO;
} - (void)tabBarController:(UITabBarController *)tabBarController didSelectViewController:(UIViewController *)viewController
{
NSLog(@"didSelectViewController!");
} @end
 
 
//
// SvTabBarFirstViewController.h
// SvTabBarControllerSample
//
// Created by maple on 5/19/12.
// Copyright (c) 2012 smileEvday. All rights reserved.
// #import <UIKit/UIKit.h> @interface SvTabBarFirstViewController : UIViewController @end
 
 
//
// SvTabBarFirstViewController.m
// SvTabBarControllerSample
//
// Created by maple on 5/19/12.
// Copyright (c) 2012 smileEvday. All rights reserved.
// #import "SvTabBarFirstViewController.h" @interface SvTabBarFirstViewController () @end @implementation SvTabBarFirstViewController - (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
if (self) { self.tabBarItem.image = [UIImage imageNamed:@"first"];
}
return self;
} - (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
self.view.backgroundColor = [UIColor whiteColor];
} - (void)viewDidUnload
{
[super viewDidUnload];
// Release any retained subviews of the main view. } - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone) {
return (interfaceOrientation != UIInterfaceOrientationPortraitUpsideDown);
} else {
return YES;
}
} - (void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration
{
NSLog(@"%@ rotate!", self.title);
} - (NSString*)description
{
return [NSString stringWithFormat:@"title: %@", self.title];
} @end
 
 
//
// SvTabBarSecondViewController.h
// SvTabBarControllerSample
//
// Created by maple on 5/19/12.
// Copyright (c) 2012 smileEvday. All rights reserved.
// #import <UIKit/UIKit.h> @interface SvTabBarSecondViewController : UIViewController @end
 
 
//
// SvTabBarSecondViewController.m
// SvTabBarControllerSample
//
// Created by maple on 5/19/12.
// Copyright (c) 2012 smileEvday. All rights reserved.
// #import "SvTabBarSecondViewController.h" @interface SvTabBarSecondViewController () @end @implementation SvTabBarSecondViewController - (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
if (self) {
self.tabBarItem.image = [UIImage imageNamed:@"second"];
}
return self;
} - (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
self.view.backgroundColor = [UIColor greenColor];
} - (void)viewDidUnload
{
[super viewDidUnload];
// Release any retained subviews of the main view.
} - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
//return (interfaceOrientation == UIInterfaceOrientationPortrait);
return YES;
} @end

UITabBarController使用详解的更多相关文章

  1. 学习笔记:UITabBarController使用详解

    一.手动创建UITabBarController 最常见的创建UITabBarController的地方就是在application delegate中的 applicationDidFinishLa ...

  2. UITabBarController详解

    UITabBarController使用详解 UITabBarController是IOS中很常用的一个viewController,例如系统的闹钟程序,ipod程序等.UITabBarControl ...

  3. iOS开发——控制器OC篇&UINavigationController&UITabBarController详解

    UINavigationController&UITabBarController详解 一:UINavigationController 控制器的属性: UINavigationControl ...

  4. iOS 视图控制器转场详解

    iOS 视图控制器转场详解 前言的前言 唐巧前辈在微信公众号「iOSDevTips」以及其博客上推送了我的文章后,我的 Github 各项指标有了大幅度的增长,多谢唐巧前辈的推荐.有些人问我相关的问题 ...

  5. iOS应用开发详解

    <iOS应用开发详解> 基本信息 作者: 郭宏志    出版社:电子工业出版社 ISBN:9787121207075 上架时间:2013-6-28 出版日期:2013 年7月 开本:16开 ...

  6. Linq之旅:Linq入门详解(Linq to Objects)

    示例代码下载:Linq之旅:Linq入门详解(Linq to Objects) 本博文详细介绍 .NET 3.5 中引入的重要功能:Language Integrated Query(LINQ,语言集 ...

  7. 架构设计:远程调用服务架构设计及zookeeper技术详解(下篇)

    一.下篇开头的废话 终于开写下篇了,这也是我写远程调用框架的第三篇文章,前两篇都被博客园作为[编辑推荐]的文章,很兴奋哦,嘿嘿~~~~,本人是个很臭美的人,一定得要截图为证: 今天是2014年的第一天 ...

  8. EntityFramework Core 1.1 Add、Attach、Update、Remove方法如何高效使用详解

    前言 我比较喜欢安静,大概和我喜欢研究和琢磨技术原因相关吧,刚好到了元旦节,这几天可以好好学习下EF Core,同时在项目当中用到EF Core,借此机会给予比较深入的理解,这里我们只讲解和EF 6. ...

  9. Java 字符串格式化详解

    Java 字符串格式化详解 版权声明:本文为博主原创文章,未经博主允许不得转载. 微博:厉圣杰 文中如有纰漏,欢迎大家留言指出. 在 Java 的 String 类中,可以使用 format() 方法 ...

随机推荐

  1. JavaEE Tutorials (26) - 批处理

    26.1批处理介绍391 26.1.1批处理作业中的步骤391 26.1.2并行处理392 26.1.3状态和判定元素392 26.1.4批处理框架功能39326.2Java EE中的批处理394 2 ...

  2. matlab---边缘之sobel简单实例

    最近在项目中需要做一些图像边缘检测的工作,但是由于之前没接触过图像处理的相关知识,所以只得 在matlab里面对一些图像处理函数挨个挨个的试着用.在用的过程中在慢慢的明白了一些简单的图像处 理方法. ...

  3. ubuntu 命令

    用mount命令加载iso到虚拟光驱 先在/media/目录下新建一个空目录作为加载iso的虚拟光驱名称: sudo mkdir /media/aaaa 再用mount挂载: sudo mount - ...

  4. 【LeetCode练习题】Gas Station

    Gas Station There are N gas stations along a circular route, where the amount of gas at station i is ...

  5. Sonar入门(二): Maven集成Sonar

    Sonar对maven提供了简单可配的支持,要做的事情很简单——在maven/conf下settings.xml <profiles></profiles>标签之间添加如下内容 ...

  6. Android4.0中蓝牙适配器state machine(状态机)的分析

    今天晓东和大家来一起看一下Android4.0中蓝牙适配器(Bluetooth Adapter)的状态机变化的过程.首先,我们需要了解一下,蓝牙适配器究竟有哪些状态,从代码可以清晰地看到(framew ...

  7. Linux主机规划与磁盘分区

    各硬件设备在Linux中的文件名 在Linux系统当中,几乎所有的硬件设备文件都在/dev这个目录内. 各硬件设备在Linux中的文件名: 设备 设备在Linux中的文件名 IDE接口的硬盘 /dev ...

  8. OC基础10:基本的C语言特性1

    "OC基础"这个分类的文章是我在自学Stephen G.Kochan的<Objective-C程序设计第6版>过程中的笔记. 1.  函数和方法的区别? (1).方法包 ...

  9. Fire Net(dfs)

    Fire Net Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Su ...

  10. plaidctf2015 ebp

    很容易看出是格式化字符串漏洞.这里的格式化字符串漏洞不像传统的那样,格式化字符串是放在bss段中,并没放在栈上,因此利用起来有些困难. 不过,我们可以利用ebp,可以修改函数的ebp,从而能控制函数的 ...