block动画TableViewController的navigation
image1=[[UIImageViewalloc]initWithImage:[UIImageimageNamed:@"pingguo.jpg"]];
image1.frame=CGRectMake(100, 100, 100, 110);
[self.view addSubview:image1];
[UIViewbeginAnimations:@"animate1"context:image1];
[UIViewsetAnimationDuration:2];
[UIViewsetAnimationDelegate:self];
// [UIView setAnimationDidStopSelector:@selector(animationDidStop: finished: context:)];
// [image1 setCenter:CGPointMake(image1.center.x+100, image1.center.y+200)];
[UIViewanimateWithDuration:4animations:^{
[image1 setCenter:CGPointMake(image1.center.x+100, image1.center.y+200)];
} completion:^(BOOL finished) {
[image1removeFromSuperview];
}
];
[UIViewcommitAnimations];
}
//-(void)animationDidStop:(NSString *)animationID finished:(NSNumber *)finished context:(void *)context{
// [(UIImageView *)context removeFromSuperview];
//}
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
self.window = [[[UIWindowalloc] initWithFrame:[[UIScreenmainScreen] bounds]] autorelease];
// Override point for customization after application launch.
self.window.backgroundColor = [UIColorwhiteColor];
[self.windowmakeKeyAndVisible];
TableViewController *table = [[TableViewControlleralloc] initWithStyle:UITableViewStyleGrouped];//使TabkeViewController初始化
UINavigationController *nav = [[UINavigationControlleralloc] initWithRootViewController:table]; //初始化nav 并把TableViewController作为navigation的主窗口显示
[self.windowsetRootViewController:nav];
[table release];
[nav release];
returnYES;
}
@interface TableViewController : UITableViewController {
NSArray *array;
}
#import "TableViewController.h"
#import "MyViewController.h"
@implementation TableViewController
- (id)initWithStyle:(UITableViewStyle)style
{
self = [super initWithStyle:style];
if (self) {
array = [[NSArray alloc] initWithObjects:@"one", nil];
}
returnself;
}
- (void)viewDidLoad
{
[superviewDidLoad];
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
return array.count;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *CellIdentifier = @"Cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (!cell) {
cell = [[[UITableViewCellalloc] initWithStyle:UITableViewCellStyleDefaultreuseIdentifier:CellIdentifier] autorelease];
}
//下面三行是自己写的。
NSString *string = [array objectAtIndex:[indexPath row]];
[cell.textLabel setText:string];
return cell;
}
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
MyViewController *myph = [[MyViewControlleralloc] init];
[self.navigationControllerpushViewController:myph animated:YES];
[myph release];
}
@end
相关推荐
xcode 4的简单navigation+tableviewcontroller
将dataSource分离出去,减小TableViewController的体积
封住的tablevIewController基类,集成了DZNEmptyDataSet 和MJRefresh
通过简单的操作,快速完成一个基本的tableViewController。 几乎每个像样软件都会用到UITableViewController,所以你就可以使用到PYTableViewController 主要用在我的模块、个人信息、设置等。如下是各大流行软件...
一个简单的iPhone TableViewController,用于添加“按需刷新”功能。 受启发, 和 。 如何安装 将文件 ,和到您的项目中。 链接到QuartzCore框架(用于旋转箭头图像)。 创建一个TableViewController,它是...
来源:Licence:MIT平台:iOS设备:iPhone / iPad作者:Kent Nguyen 实现Path应用的时间滚动条效果:即在列表中,移动滚动条的同时,旁边出现信息标签,用于显示移动到哪个列表单元。 Code4App编译测试,适用...
快速实现下拉刷新上接加载UITableViewController,可以自定义UI 下载地址:https://code.csdn.net/RyanFang/rfquicklytableviewcontroller.git
CMBALTableViewController 当使用autolayout来处理cell布局时,CMBALTableViewControll可以自动帮你计算并缓存tableViewCell的高度 你所需要做的只是声明model与cell对应关系。You needn't write any code to handl...
文字视图(Text)之Messages TableViewController 文字视图(Text)之TextView Placeholder 文字视图-HashTag Mention Controller 文字视图-Tweet Label 文字视图类--Digit Input 文字视图类--emoji-converter ...
要重现,请确保TableViewController.m SHOW_BUG定义为1 。 点击UITableViewCell将它们移动到列表的顶部。 请注意,当单元格的源和目标索引路径都可见时,一切都按预期运行。 然后,向下滚动以使目标(表格视图的...
iphone上的一个很详细的例子程序,展示了TableViewController,DataSource,FlipView等常用界面的用法
TableViewControllerBuilder 我们创建了一个框架,可帮助iOS工程师创建通用的表格视图控制器,并尽可能减少样板代码。 当我们为表视图编写代码时,我们不想重复自己:创建一个表视图数据源,一个表视图委托。...
漂亮的飞溅动画 旋转兼容 安装 抓取View/AnchoredFloatView的文件并将其放入您的项目中。 该代码使用 ARC,因此如果您尚未使用 ARC,请确保为文件启用该功能。 用法 在 tableViewController 上导入头类: # import ...
如果直接在TableVIewController上贴Button的话会导致这个会随之滚动,下面解决在TableView上实现位置固定悬浮按钮的两种方法: 1.在view上贴tableView,然后将悬浮按钮贴在view的最顶层 2.使用window 首先看一下...
在TableViewController中,必须为估计的行高设置一些值,然后将表视图的rowHeight设置为自动标注: - (void)viewDidLoad { [super viewDidLoad]; self.tableView.estimatedRowHeight = self.tableView.rowHeight...
要在哪个视图上做动画,一般是动画视图的父视图 [UIView setAnimationTransition:UIViewAnimationTransitionCurlUp forView:_window cache:YES]; //commit 提交 [UIView commitAnimations]; //索引为0表示先...
IOS面试题归总 Object-C有多继承吗?没有的话用什么代替 Object-C有私有方法吗?私有变量呢 关键字const什么含义 关键字volatile有... 为什么很多内置的类,如TableViewController的delegate的属性是assign不是retain?
#import TableViewController.h static NSString *ident = @cell; #define RGBA(r,g,b,a) [UIColor colorWithRed:r/255.0f green:g/255.0f blue:b/255.0f alpha:a] #define RGB(r,g,b) RGBA(r,g,b,1.0f) #define ...
提供十分方便的静态内容列表(Static Content TableViewController)编写API。静态内容列表一般用于app的设置页面、登录页面、或者关于页面等等。实现的功能还包括能够十分方便地动态添加cell到列表中。代码本身用...
ContactBook iOS practice demo of NavigationController 私人通讯录 使用了 NavigationController, TableViewController 练习数据的存储(plist, preferences) storyboard 中的 segue