Iphone Table.m
2011-03-01 12:50:33

//

// TweetViewController.m

// TwitterBiKE

//

// Created by Kyungmin Lee on 1/30/11.

// Copyright 2011 BiKE. All rights reserved.

//

//메모리 해제는 '- (void)viewDidUnload'와 '- (void)dealloc' 에서 모두 신경써야 한다.

#import "TweetViewController.h"

#define kScreenNameValueTag 1

#define kCreatingAtValueTag 2

#define kTweetTextValueTag 3

@implementation TweetViewController

@synthesize listData;

#pragma mark -

#pragma mark View lifecycle

- (void)viewDidLoad {

NSString * str1 = @"asdf";

NSString * str2 = @"fdsasl;dfijhasldfijafasdfasfsadfasdfasfsadf";

NSArray *array = [[NSArray alloc] initWithObjects:str1,str2,str2,str2,str2,nil];

self.listData = array;

[str1 release];

[str2 release];

[array release];

}

#pragma mark -

#pragma mark Table view data source

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {

// Return the number of sections.

return 1;

}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {

// Return the number of rows in the section.

return [self.listData count];

}

// Customize the appearance of table view cells.

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {

//셀의 식별자를 설정한다.이유는 잘 모름 아직은;

static NSString *tweetTableIdentifier =@"TweetTableIdentifier";

//셀 객체를 얻어온다.

UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:tweetTableIdentifier];

//셀의 모양(appearance)을 결정하는 부분.

if(cell ==nil){//셀이 비었다면 새로운 셀을 만든다.

cell = [[[UITableViewCell alloc]

initWithStyle:UITableViewCellStyleDefault

reuseIdentifier:tweetTableIdentifier] autorelease];

//UILabel을 이용하여 글 상자를 만든다.

// ScreenName LabelRect

CGRect screenNameValueRect = CGRectMake(0,0,70,8);

UILabel *screenNameValue = [[UILabel alloc] initWithFrame:screenNameValueRect];

screenNameValue.font = [UIFont systemFontOfSize:8];

screenNameValue.tag = kScreenNameValueTag;

[cell.contentView addSubview: screenNameValue];

[screenNameValue release];

}

NSUInteger row = [indexPath row];

//NSLog(@"Now %d",row);

//row 에 따라서 다른 그림이 보이도록한다.

UIImage *image = [UIImage imageNamed:@"tweetTAB.png"];

cell.imageView.image = image;

// UILabel을 이용하여 글 상자에 글을 넣는다.

//Screen Name

NSString *rowData = [self.listData objectAtIndex:row];

UILabel *screenName = (UILabel *)[cell.contentView viewWithTag:kScreenNameValueTag];

screenName.text = rowData;

return cell;

}

#pragma mark -

#pragma mark Table view delegates

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {

// 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];

*/

}

#pragma mark -

#pragma mark Memory management

- (void)didReceiveMemoryWarning {

// Releases the view if it doesn't have a superview.

[super didReceiveMemoryWarning];

// Relinquish ownership any cached data, images, etc. that aren't in use.

}

- (void)viewDidUnload {

//\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0 Relinquish ownership of anything that can be recreated in viewDidLoad or on demand.

// For example: self.myOutlet = nil;

self.listData = nil;

[super viewDidUnload];

}

- (void)dealloc {

[listData release];

[super dealloc];

}

@end

▼ more
가장 지키기 쉽고
2011-03-01 07:54:52

바라보기 어려운

시간계획은

지금 생활의 시간표 이다.

▼ more
WOL 설정 의무화
2011-02-28 16:44:27

아마 서버가 연결된 놋북은 안될지도 모르지만 ㅋ

본체는 될 듯

서버가 아쉽지만 본체는 쓸 때만 켜면 되니 더 굿 ㅋ

▼ more
ViewController to TabBarController...
2011-02-28 15:20:23

I've just completed pretty much the same and ran into the same problems but eventually I got it working.

Create a View Controller class in Xcode called Test1ViewController and add the following:

@interface Test1ViewController : UIViewController {

IBOutlet UITabBarController *tbc;

}

@property (nonatomic,retain) IBOutlet UITabBarController *tbc;

@end

Create a View XIB called Test1View

Add a TabBarViewController to the XIB

Set the File's Owner in the XIB to be the Test1ViewController.

Connect the tbc IBOutlet in the File's Owner to the Tab Bar Controller in the XIB.

Connect the view IBOutlet in the File's Owner to the View in the XIB.

In your SplashViewController.h add the property

Test1ViewController *tabBarViewController;

Synthesize the tabBarViewController in your SplashViewController.m.

Replace your TabBarController creation code in your loadView method in SplashViewController with the following:

tabBarViewController = [[Test1ViewController alloc] initWithNibName:

@"Test1View" bundle:[NSBundle mainBundle]];

tabBarViewController.view.alpha = 0.0;

[self.view addSubview:[tabBarViewController view]];

Here's the bit that was missing for me. In Test1ViewController.m, you need to add the following line to the viewDidLoad method:

self.view = tbc.view;

Finally, I also had to change the finishedFading method in SplashViewController.m to set the alpha to 1.0 on the tabBarViewController view.

-(void) finishedFading

{

[UIView beginAnimations:nil context:nil];

[UIView setAnimationDuration:0.75];

self.view.alpha = 1.0;

tabBarViewController.view.alpha = 1.0;

[UIView commitAnimations];

[splashImageView removeFromSuperview];

}

I hope this helps.

SpashView는 TabBarViewController를 불러올 화면이다.

▼ more