- 浏览: 635019 次
文章分类
最新评论
-
涛声依旧是:
怎么提示掉线,怎么才能在线
基于Tomcat7、Java、WebSocket的服务器推送聊天室 -
dcode:
楼主写的不错,正好遇到点问题,看着你的文章解决了,感谢分享。。 ...
在 Visual Studio 2010 中配置SharpPcap
iphone---在表格中实现页面切换和修改
//
// EditViewController.h
// Iphome_day01
//
// zz
// Copyright (c) 2012年 __MyCompanyName__. All rights reserved.
//
#import <UIKit/UIKit.h>
#import "movie.h"
@class ViewController;
@interface EditViewController : UIViewController <UITextFieldDelegate>
{
movie* editMovie;
UITextField *NameField;
UITextField *PriceField;
UITextField *SummaryField;
}
@property(nonatomic,retain) IBOutlet UITextField* NameField;
@property(nonatomic,retain) IBOutlet UITextField* PriceField;
@property(nonatomic,retain) IBOutlet UITextField* SummaryField;
@property(nonatomic,retain)movie* editMovie;
-(BOOL)textFieldShouldReturn:(UITextField *)textField;//去除键盘
-(IBAction)Back:(id)sender;
@end
//
// EditViewController.m
// Iphome_day01
//
// zz
// Copyright (c) 2012年 __MyCompanyName__. All rights reserved.
//
#import "EditViewController.h"
#import "ViewController.h"
#import "movie.h"
@implementation EditViewController
@synthesize NameField;
@synthesize PriceField;
@synthesize SummaryField;
@synthesize editMovie;
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
if (self) {
// Custom initialization
}
return self;
}
- (void)didReceiveMemoryWarning
{
// Releases the view if it doesn't have a superview.
[super didReceiveMemoryWarning];
// Release any cached data, images, etc that aren't in use.
}
#pragma mark - View lifecycle
- (void)viewDidLoad
{
NSLog(@"%@",editMovie);
NameField.text=editMovie.name;
PriceField.text=[NSString stringWithFormat:@"%d", editMovie.price];
SummaryField.text=editMovie.summary;
[super viewDidLoad];
// Do any additional setup after loading the view from its nib.
}
- (void)viewDidUnload
{
NameField=nil;
PriceField=nil;
SummaryField=nil;
[super viewDidUnload];
// Release any retained subviews of the main view.
// e.g. self.myOutlet = nil;
}
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
// Return YES for supported orientations
return (interfaceOrientation == UIInterfaceOrientationPortrait);
}
-(IBAction)Back:(id)sender{
// [self dismissModalViewControllerAnimated:YES];
[self.navigationController popToRootViewControllerAnimated:YES];
NSLog(@"back called!!");
}
-(void)dealloc{
[NameField release];
[PriceField release];
[SummaryField release];
[super dealloc];
}
//去掉键盘
-(BOOL)textFieldShouldReturn:(UITextField *)textField{
[textField resignFirstResponder];
return YES;
}
-(void)textFieldDidEndEditing:(UITextField *)textField{
if(NameField==textField){
//把textfield的文本给name赋值
editMovie.name=textField.text;
}
else if(PriceField==textField){
editMovie.price=[textField.text intValue];
}else{
editMovie.summary=textField.text;
}
NSLog(@"%@",editMovie);
}
@end
EditViewController.xib
省略
//
// ViewController.h
// Iphome_day01
//
//
// Copyright (c) 2012年 __MyCompanyName__. All rights reserved.
//
#import <UIKit/UIKit.h>
@class movie;
@interface ViewController : UIViewController
{
movie * mo;
UILabel* label1;
UILabel* label2;
UILabel* label3;
}
@property(nonatomic,retain)movie *mo;
@property(nonatomic,retain) IBOutlet UILabel* label1;
@property(nonatomic,retain) IBOutlet UILabel* label2;
@property(nonatomic,retain) IBOutlet UILabel* label3;
-(IBAction)Edit:(id)sender;//实现
//系统会每次都调用该方法
- (void)viewWillAppear:(BOOL)animated;
@end
//
// ViewController.m
// Iphome_day01
//
//
// Copyright (c) 2012年 __MyCompanyName__. All rights reserved.
//
#import "ViewController.h"
#import "movie.h"
#import "EditViewController.h"
@implementation ViewController
@synthesize mo;
@synthesize label1;
@synthesize label2;
@synthesize label3;
- (void)didReceiveMemoryWarning
{
[super didReceiveMemoryWarning];
// Release any cached data, images, etc that aren't in use.
}
#pragma mark - View lifecycle
- (void)viewDidLoad
{
// mo=[[movie alloc]initWithName:@"龙门飞甲" andPrice:200 andSummary:@"古装片"];
// self.title=@"电影详情";
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
}
- (void)viewDidUnload
{
label1=nil;
label2=nil;
label3=nil;
mo=nil;
[super viewDidUnload];
// Release any retained subviews of the main view.
// e.g. self.myOutlet = nil;
}
- (void)viewWillAppear:(BOOL)animated
{
label1.text= mo.name;
label2.text=[NSString stringWithFormat:@"%d",mo.price];
label3.text=mo.summary;
[super viewWillAppear:animated];
}
- (void)viewDidAppear:(BOOL)animated
{
[super viewDidAppear:animated];
}
- (void)viewWillDisappear:(BOOL)animated
{
[super viewWillDisappear:animated];
}
- (void)viewDidDisappear:(BOOL)animated
{
[super viewDidDisappear:animated];
}
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
// Return YES for supported orientations
return (interfaceOrientation != UIInterfaceOrientationPortraitUpsideDown);
}
-(void)dealloc{
label1=nil;
label2=nil;
label3=nil;
[mo release];
[super dealloc];
}
-(IBAction)Edit:(id)sender{
EditViewController *edit=[[EditViewController alloc]initWithNibName:@"EditViewController" bundle:nil];
edit.editMovie=mo;
/*
UIModalTransitionStyleCoverVertical = 0,
UIModalTransitionStyleFlipHorizontal,//翻转
UIModalTransitionStyleCrossDissolve,//渐变
#if __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_3_2
UIModalTransitionStylePartialCurl,//翻页
*/
edit.modalTransitionStyle=UIModalTransitionStyleFlipHorizontal;
// [self presentModalViewController:edit animated:YES ];//UIViewController 的压栈方法
[self.navigationController pushViewController:edit animated:YES];//导航UINavigationController的压栈方法
[edit autorelease];
NSLog(@"edit called!!!");
}
@end
//
// movie.h
// day04
//
//
// Copyright (c) 2012年 __MyCompanyName__. All rights reserved.
//
#import <Foundation/Foundation.h>
@interface movie : NSObject <NSCopying, NSCoding>
{
NSString* name;
int price;
NSString* summary;
}
@property(nonatomic,copy) NSString* name;
@property(nonatomic,assign)int price;
@property(nonatomic,copy)NSString* summary;
-(id)init;
-(id)initWithName:(NSString*)_name andPrice:(int)_price andSummary:(NSString*)_summary;
-(void)encodeWithCoder:(NSCoder *)aCoder;
-(id)initWithCoder:(NSCoder *)aDecoder;
-(NSComparisonResult)compareName:(id)element;
-(NSComparisonResult)comparePrice:(id)element;
-(NSComparisonResult)compareSummary:(id)element;
@end
//
// movie.m
// day04
//
//
// Copyright (c) 2012年 __MyCompanyName__. All rights reserved.
//
#import "movie.h"
@implementation movie
@synthesize name;
@synthesize price;
@synthesize summary;
-(id)init{
self=[super init];
if(!self){
return nil;
}
name=[[NSString alloc] initWithFormat:@"zhang"];
if(!name){
[self release];
return nil;
}
// [name autorelease];
price=15;
summary=[[NSString alloc] initWithFormat:@"asdf"];
if(!summary){
[self release];
return nil;
}
// [summary autorelease];
return self;
}
-(id)initWithName:(NSString*)_name andPrice:(int)_price andSummary:(NSString*)_summary{
if(!_name||_price<0||!_summary){
NSLog(@"--------------");
[self release];
return nil;
}
self=[super init];//这个地方应该是调用谁的初始化方法
if(!self){
return nil;
}
name=[[NSString alloc] initWithFormat:@"%@",_name];
if(!name){
[self release];
return nil;
}
//[name autorelease];
price=_price;
summary=[[NSString alloc] initWithFormat:@"%@",_summary];
if(!summary){
[self release];
return nil;
}
//[summary autorelease];
return self;
}
-(NSString*)description{
NSString* ns= [[NSString alloc]initWithFormat:@"name:%@,price:%d,summary:%@",name,price,summary];
[ns autorelease];
return ns;
}
-(void)dealloc{
[name release];
[summary release];
[super dealloc];
}
-(id)copyWithZone:(NSZone *)zone{
movie* m=[[movie allocWithZone:zone]initWithName:@"adsfadf" andPrice:1 andSummary:@"qer"];
return m;
}
-(void)encodeWithCoder:(NSCoder *)aCoder{
[aCoder encodeObject:name forKey:@"name"];
[aCoder encodeInt:price forKey:@"price"];
[aCoder encodeObject:summary forKey:@"summary"];
}
-(id)initWithCoder:(NSCoder *)aDecoder{
if((self=[super init])){
self.name=[aDecoder decodeObjectForKey:@"name"];
self.price=[aDecoder decodeIntForKey:@"price"];
self.summary=[aDecoder decodeObjectForKey:@"summary"];
}
return self;
}
-(NSComparisonResult)compareName:(id)element
{
//NSString* str1 = [NSString stringWithString:name];
//NSString* str2 = [NSString stringWithString:[element name]];
//return [str1 compare:str2];
return [name compare:[element name]];
}
-(NSComparisonResult)comparePrice:(id)element{
NSNumber* n1=[NSNumber numberWithInt:price];
NSNumber* n2=[NSNumber numberWithInt:[element price]];
return [n1 compare:n2];
}
-(NSComparisonResult)compareSummary:(id)element{
return [summary compare:[element summary]];
}
@end
//
// movieList.h
// day04
//
//
// Copyright (c) 2012年 __MyCompanyName__. All rights reserved.
//
#import <Foundation/Foundation.h>
#import "movie.h"
@interface movieList : NSObject <NSCoding>
{
NSMutableArray* mta;
}
@property(nonatomic,copy)NSMutableArray* mta;
- (void)addMovie:(id)anMovie;
- (void)insertMovie:(id)anMovie atIndex:(NSUInteger)_index;
- (void)removeLastMovie;
- (void)removeMovieAtIndex:(NSUInteger)index;
- (void)replaceMovieAtIndex:(NSUInteger)index withObject:(id)anObject;
- (NSUInteger)Count;
- (NSUInteger)indexOfMovie:(id)anObject;
- (movie*)MovieOfIndex:(NSInteger)index;
-(id)init;
-(id)initWithMovieList:(NSMutableArray*)_mta;
-(void)dealloc;
-(NSString*)description;
-(void)encodeWithCoder:(NSCoder *)aCoder;
-(id)initWithCoder:(NSCoder *)aDecoder;
-(void)sortName;
-(void)sortPrice;
-(void)sortSummary;
@end
//
// movieList.m
// day04
//
//
// Copyright (c) 2012年 __MyCompanyName__. All rights reserved.
//
#import "movieList.h"
@implementation movieList
@synthesize mta;
-(id)init{
self=[super init];
if(!self){
return nil;
}
mta=[ [NSMutableArray alloc]init];
return self;
}
-(id)initWithMovieList:(NSMutableArray*)_mta{
if(!_mta){
[self release];
return nil;
}
self=[self init];
if(!self){
return nil;
}
mta=[_mta retain];
return self;
}
- (void)addMovie:(id)anMovie{
[mta addObject:anMovie];
}
- (void)insertMovie:(id)anMovie atIndex:(NSUInteger)_index{
[mta insertObject:anMovie atIndex:_index];
}
- (movie*)MovieOfIndex:(NSInteger)index
{
return [mta objectAtIndex:index];
}
- (void)removeLastMovie{
[mta removeLastObject];
}
- (void)removeMovieAtIndex:(NSUInteger)index{
[mta removeObjectAtIndex:index];
}
- (void)replaceMovieAtIndex:(NSUInteger)index withObject:(id)anObject{
[mta replaceObjectAtIndex:index withObject:anObject];
}
-(void)dealloc{
[super dealloc];
}
-(NSString*)description{
NSMutableString* ns=[[NSMutableString alloc ]init];
for(movie* item in mta)
{
[ns appendFormat:@"%@\n",[item description]];
}
return ns;
}
-(void)encodeWithCoder:(NSCoder *)aCoder{
[aCoder encodeObject:mta forKey:@"mta"];
}
-(id)initWithCoder:(NSCoder *)aDecoder{
if((self=[super init])){
self.mta=[aDecoder decodeObjectForKey:@"mta"];
}
return self;
}
- (NSUInteger)Count{
return [mta count];
}
-(void)sortName{
[mta sortUsingSelector:@selector(compareName:)];
}
-(void)sortSummary{
[mta sortUsingSelector:@selector(compareSummary:)];
}
-(void)sortPrice{
[mta sortUsingSelector:@selector(comparePrice:)];
}
- (NSUInteger)indexOfMovie:(id)anObject{
return [mta indexOfObject:anObject];
}
@end
//
// MovieDB.h
// day04
//
// zz
// Copyright (c) 2012年 __MyCompanyName__. All rights reserved.
//
#import <Foundation/Foundation.h>
#import "movieList.h"
#import "movie.h"
@class movie;
@class movieList;
@interface MovieDB : NSObject
{
NSString* filePath;
movieList* ml;
}
@property(nonatomic,retain)NSString* filePath;
@property(nonatomic,retain)movieList* ml;
- (id)init;
- (id)initWithPath:(NSString*)_filePath
andList:(movieList*)_ml;
- (void)addMovie:(id)anMovie;
- (void)insertMovie:(id)anMovie atIndex:(NSUInteger)_index;
- (void)removeLastMovie;
- (void)removeMovieAtIndex:(NSUInteger)index;
- (void)replaceMovieAtIndex:(NSUInteger)index withObject:(id)anObject;
- (NSUInteger)Count;
- (NSUInteger)indexOfMovie:(id)anObject;
- (movie*)MovieOfIndex:(NSInteger)index;
- (void)sortMovieListName;
- (void)sortMovieListPrice;
- (void)sortMovieListSummary;
- (BOOL)save;
- (BOOL)read;
-(NSString*)description;
@end
//
// MovieDB.m
// day04
//
// Created by zz
// Copyright (c) 2012年 __MyCompanyName__. All rights reserved.
//
#import "MovieDB.h"
#import "movie.h"
#import "movieList.h"
@implementation MovieDB
@synthesize ml;
@synthesize filePath;
- (id)init{
self=[super init];
if(!self){
return nil;
}
ml=[[movieList alloc]init];
if(!ml){
[self release];
return nil;
}
filePath=[NSString stringWithFormat:@"/tmp/zhang.txt"];
return self;
}
- (id)initWithPath:(NSString*)_filePath
andList:(movieList*)_ml{
if(!_filePath||!_ml){
[self release];
return nil;
}
self=[super init];
if(!self){
return nil;
}
ml=[_ml retain];
filePath=[NSString stringWithString:_filePath];
if(!filePath){
[self release];
return nil;
}
return self;
}
- (void)sortMovieListName{
[ml sortName];
}
- (void)sortMovieListPrice{
[ml sortPrice];
}
- (void)sortMovieListSummary{
[ml sortSummary];
}
- (BOOL)save{
BOOL flag=YES;
NSMutableArray * phrase=[NSMutableArray arrayWithObjects:[self description], nil];
[phrase writeToFile:filePath atomically:YES];
if(!phrase){
NSLog(@"写入失败!");
return NO;
}
return flag;
}
- (BOOL)read{
NSFileManager* fm;
fm=[NSFileManager defaultManager];
NSData* fileData;
fileData=[fm contentsAtPath:filePath];
BOOL ifsucess=NO;
ifsucess=[fm createFileAtPath:@"/tmp/MovieDB.txt" contents:fileData attributes:nil];
if(ifsucess){
NSLog(@"读入成功!");
}else{
NSLog(@"读入失败!");
}
return ifsucess;
}
-(NSString*)description{
return [ml description];
}
- (void)addMovie:(id)anMovie{
[ml addMovie:anMovie];
}
- (void)insertMovie:(id)anMovie atIndex:(NSUInteger)_index{
[ml insertMovie:anMovie atIndex:_index];
}
- (void)removeLastMovie{
[ml removeLastMovie];
}
- (void)removeMovieAtIndex:(NSUInteger)index{
[ml removeMovieAtIndex:index];
}
- (void)replaceMovieAtIndex:(NSUInteger)index withObject:(id)anObject{
[ml replaceMovieAtIndex:index withObject:anObject];
}
- (NSUInteger)Count{
return [ml Count];
}
- (NSUInteger)indexOfMovie:(id)anObject{
return [ml indexOfMovie:anObject];
}
- (movie*)MovieOfIndex:(NSInteger)index{
return [ml MovieOfIndex:index];
}
@end
//
// AppDelegate.h
// MoveTable
//
// Created by zz.
// Copyright (c) 2012年 __MyCompanyName__. All rights reserved.
//
#import <UIKit/UIKit.h>
@class MovieTableViewController;
@interface AppDelegate : UIResponder <UIApplicationDelegate>
@property (strong, nonatomic) UIWindow *window;
@property (strong,nonatomic)MovieTableViewController *tableView;
@property (strong,nonatomic)UINavigationController * navigate;
@end
//
// AppDelegate.m
// MoveTable
//
// Created by zz
// Copyright (c) 2012年 __MyCompanyName__. All rights reserved.
//
#import "AppDelegate.h"
#import "MovieTableViewController.h"
@implementation AppDelegate
@synthesize window = _window;
@synthesize tableView=_tableView;
@synthesize navigate=_navigate;
- (void)dealloc
{
[_navigate release];
[_tableView release];
[_window 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.
self.window.backgroundColor = [UIColor whiteColor];
_tableView=[[MovieTableViewController alloc]initWithNibName:@"MovieTableViewController" bundle:nil];
_navigate=[[UINavigationController alloc]initWithRootViewController:_tableView];
[self.window addSubview:_tableView.view];
[self.window addSubview:_navigate.view];
[self.window makeKeyAndVisible];
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:.
*/
}
@end
//
// MovieTableViewController.h
// MoveTable
//
// Created by zz
// Copyright (c) 2012年 __MyCompanyName__. All rights reserved.
//
#import <UIKit/UIKit.h>
@class MovieDB;
@interface MovieTableViewController : UITableViewController
{
MovieDB *_iMovieDB;
}
@property (strong,nonatomic)MovieDB * iMovieDB;
@end
//
// MovieTableViewController.m
// MoveTable
//
// Created by zz
// Copyright (c) 2012年 __MyCompanyName__. All rights reserved.
//
#import "MovieTableViewController.h"
#import "MovieDB.h"
#import "movie.h"
#import "ViewController.h"
#import "EditViewController.h"
@implementation MovieTableViewController
@synthesize iMovieDB=_iMovieDB;
- (id)initWithStyle:(UITableViewStyle)style
{
self = [super initWithStyle:style];
if (self) {
// Custom initialization
}
return self;
}
- (void)didReceiveMemoryWarning
{
// Releases the view if it doesn't have a superview.
[super didReceiveMemoryWarning];
// Release any cached data, images, etc that aren't in use.
}
#pragma mark - View lifecycle
- (void)viewDidLoad
{
[super viewDidLoad];
self.title=@"电影描述";
movie* m1=[[movie alloc]initWithName:@"龙门飞甲" andPrice:24 andSummary:@"古装片"];
movie* m2=[[movie alloc]initWithName:@"失恋三十三天" andPrice:18 andSummary:@"情感片"];
movie* m3=[[movie alloc]initWithName:@"杀生" andPrice:30 andSummary:@"现代片"];
movieList* mo=[[movieList alloc]init];
[mo addMovie:m1];
[mo addMovie:m2];
[mo addMovie:m3];
_iMovieDB=[[MovieDB alloc]initWithPath:@"/tmp/bb.txt" andList:mo];
// Uncomment the following line to preserve selection between presentations.
// self.clearsSelectionOnViewWillAppear = NO;
// Uncomment the following line to display an Edit button in the navigation bar for this view controller.
// self.navigationItem.rightBarButtonItem = self.editButtonItem;
}
- (void)viewDidUnload
{
[super viewDidUnload];
// Release any retained subviews of the main view.
// e.g. self.myOutlet = nil;
}
- (void)viewWillAppear:(BOOL)animated
{
[super viewWillAppear:animated];
}
- (void)viewDidAppear:(BOOL)animated
{
[super viewDidAppear:animated];
}
- (void)viewWillDisappear:(BOOL)animated
{
[super viewWillDisappear:animated];
}
- (void)viewDidDisappear:(BOOL)animated
{
[super viewDidDisappear:animated];
}
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
// Return YES for supported orientations
return (interfaceOrientation == UIInterfaceOrientationPortrait);
}
#pragma mark - Table view data source
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
//#warning Potentially incomplete method implementation.
// Return the number of sections.
//返回几个表格
return 1;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
//#warning Incomplete method implementation.
// Return the number of rows in the section.
//返回有多少行
return [_iMovieDB Count];
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
//本方法是回调方法,根据上面的方法返回的个数,然后就会调用几次本方法,也就是说,如果上面的方法返回的个数是3,本方法会被调用三次,会一下子初始化,完成后显示在屏幕上。
//在此,此方法被调用3次,因为上面的方法返回3,然后indexpath.row 的值从0变到2,
static NSString *CellIdentifier = @"Cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];
int x= indexPath.row;
movie* m=[_iMovieDB MovieOfIndex:x];
NSLog(@"indexPagth is %d",indexPath.row);
cell.textLabel.text=m.name;
//cell.textLabel.text=[NSString stringWithFormat:@"%d",m.price];
//cell.textLabel.text=m.summary;
}
// Configure the cell...
//返回每行对应的内容
return cell;
}
/*
// Override to support conditional editing of the table view.
- (BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath
{
// Return NO if you do not want the specified item to be editable.
return YES;
}
*/
/*
// Override to support editing the table view.
- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath
{
if (editingStyle == UITableViewCellEditingStyleDelete) {
// Delete the row from the data source
[tableView deleteRowsAtIndexPaths:[NSArray arrayWithObject:indexPath] withRowAnimation:UITableViewRowAnimationFade];
}
else if (editingStyle == UITableViewCellEditingStyleInsert) {
// Create a new instance of the appropriate class, insert it into the array, and add a new row to the table view
}
}
*/
/*
// Override to support rearranging the table view.
- (void)tableView:(UITableView *)tableView moveRowAtIndexPath:(NSIndexPath *)fromIndexPath toIndexPath:(NSIndexPath *)toIndexPath
{
}
*/
/*
// Override to support conditional rearranging of the table view.
- (BOOL)tableView:(UITableView *)tableView canMoveRowAtIndexPath:(NSIndexPath *)indexPath
{
// Return NO if you do not want the item to be re-orderable.
return YES;
}
*/
#pragma mark - Table view delegate
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
ViewController * vc=[[ViewController alloc]initWithNibName:@"ViewController" bundle:nil];
//indexPath.row 是当你点击一行时,它会判断你点击的是第几行,如果点击第一行,它会返回0;
int x=indexPath.row;//获取下标
movie* mm=[_iMovieDB MovieOfIndex:x ];
vc.mo=mm;
[self.navigationController pushViewController:vc animated:YES];
[vc release];
NSLog(@"indexPath2 is %d",indexPath.row);
// Navigation logic may go here. Create and push another view controller.
/*
<#DetailViewController#> *detailViewController = [[<#DetailViewController#> alloc] initWithNibName:@"<#Nib name#>" bundle:nil];
// ...
// Pass the selected object to the new view controller.
[self.navigationController pushViewController:detailViewController animated:YES];
[detailViewController release];
*/
}
@end
MovieTableViewController.xib
效果图:
相关推荐
netdisk_iPhone-2022-07-29-042850.ips
C#读写iphone中的plist文件的代码,完整的工程文件
西蒙OpenGL ES 教程 IOS开发,ios技术文档,网络收集整理。西蒙iphone-OpenGL ES 教程,共13篇。第8、12章由于有更好的技术,所以被译者跳过
OpenSSL-for-iPhone-master.zip
这是做axure的时候可以用的iPhone各种界面。
iphoneos-arm iPhone 必备工具
iphone-14-pro-max-03405318-info
iphone-coverflow,iphone-coverflow,iphone-coverflow,iphone-coverflow,iphone-coverflow,iphone-coverflow,iphone-coverflow,iphone-coverflow,iphone-coverflow
absinthe-win-2.0.4-iPhone-5.1.1-完美越狱
Apple - iPhone - 机型比较,iphone6 iphone5s and iphone5
继续输入cd Cocos2d-iPhone-0.99.5(cd Cocos2d-iPhone-0.99.5为解压的cocos2d文件夹名称)进入cocos2d文件夹中。 4。继续输入./install-templates.sh则打开你文件夹下面的install-templates.sh进行cocos2d的安装。...
这是iPhone之手势切换图片示例程序,具体参考: http://blog.csdn.net/htttw/article/details/7881955
cocos2d-iphone-extensions-v0.1.3-Himi-ios-视频-iphone 【Cocos2d游戏开发之十四】音频与音效播放以及利用+Cocos2D-iPhone-Extensions嵌入Cocos2d进行视频播放! ...
iPhone-Explorer-v2-2.dmg,查看ios设备应用程序。
关于iPhone的 OpenGL ES是建立在Xcode下,苹果推出的sdk版本中包含这个模板。我们要做的的就是帮助您建立这个模板,并在真正需要的地方方便快捷的添加有用的代码。这就是我们今天要做的。
iphone-sdk-2.0-headers 别看的不大 我坚持了一天 1k 1k的下下来的
iphone-plist-net source and Demo,iphone-plist-net是一个C#读写Plist文件的类库,iphone-plist-net源码及演示程序
iPhone-OpenGL-ES-Tutorial-Series-master iphone opengl es 源码
Documents-iPhone-8.6.1-Support-Log.zip
Beginning-iphone-games-development PART 2