블로그 이미지
Sunny's

calendar

1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30 31

Notice

2011. 8. 21. 17:43 ETC


We Rule 아이디 : SunnyDev

아이폰으로 꾸준히 하고 있는 게임은 위룰 계열 게임밖에 없네요.. ^^*

크게 어렵지도 않고 은근히 중독되는 게임..

We Rule (Level 56)
Most Visited Kingdom  (현재 순위 : 239)

 

We City (Level 45)





We Farm (Level 45)





posted by Sunny's
2010. 9. 12. 11:55 IPhone
아이폰4가 출시되었고..
아이폰4 타겟으로 개발을 하려면, 기기가 아이폰4인지 아닌지를 먼저 확인을 해야겠죠.
가장 중요한 문제가 바로 Retina 디스플레이 확인하기!
구글링을 해보니..


UIScreen scale로 알아내는 방법(링크)가 제일 낫다고 하는데(retina는 scale이 2)
여기 사용되는 함수가 SDK 3.x 에는 지원이 되지 않습니다.
그냥 4.x대의 iOS만 지원할 앱이면 위 방법을 쓰면 됩니다.
(iPad 3.2에서는 warning은 떠도 정상 작동한다는 얘기가 있지만, 아예 3.2에선 컴파일이 안되더군요;)

그래서, 
3.x와 4.x를 동시에 지원할 앱이면 
machine 이름으로 비교하는 DeviceDetection(링크)의 아랫 부분의 patgoto님의 코드를 참고하면 될 거 같네요.


#import <sys/utsname.h>


...


NSString *model= [[UIDevice currentDevicemodel];

     struct utsname u;

uname(&u);


if (!strcmp(u.machine"iPhone3,1"))

return MODEL_IPHONE_4;



posted by Sunny's
2010. 9. 8. 21:40 IPhone
iPhone/iPad SDK 3.2부터 지원되고.. 너무 간단합니다 :>

  • 프로젝트의 info.plist에 key로 UIAppFonts 를 추가하고 
  • array로 변경해서 Item X에 font 이름 쓰기
  • font화일을 프로젝트에 resource로 추가
  • font화일 오른쪽 클릭해서 '정보 입수'로 폰트 이름 확인

  • 아래 코드를 돌려보면 등록된 폰트 이름이 보이고, 이제 그냥 시스템 폰트처럼 사용하면 됩니다.
  • 화일 이름이 아니고, 위에서 확인한 폰트 이름으로 사용해야 합니다. :>
  • 혹시 UIAppFonts에 등록된 폰트가 로딩에 문제가 있으면, 디버거 콘솔창에 뭔가 출력될 겁니다~
  • cocos2d 등에서도 그냥 사용 가능

// 등록된 폰트 이름 보기

NSArray* tempFonts = [UIFont familyNames];

for(NSString* aFont in tempFonts)

NSLog(aFont);



무료 폰트 --> 헤움OTF 무료폰트96종
참고 링크 --> http://bit.ly/bl3zFi
posted by Sunny's
2010. 9. 3. 12:53 IPhone

출처 : http://cafe.naver.com/mcbugi/30423

공부를 하다 보면 책에 나오는 간단 간단한 소스가 아닌 전체 프로그램에 대한 소스를 보고 싶어질 때가 있습니다.
그래서 자료를 찾아 보았습니다. 참고하세요.
 
<push notification service 관련 provider>

<web 게시판과 연동>

http://cocoadev.tistory.com/#recentTrackback에서 공개한 내용임.
      *  이미지 편집 함수 모음( 스케일, 회전, crop 등)
  • 다양한 UI 구현
  • 테이블뷰셀 커스터마이징
  • HTTP GET/POST 요청
  • XML 파싱
  • 사진 앨범, 카메라, 지도 이미지 접근
  • 맵뷰 및 위치정보
  • 푸시 노티피케이션

<여러 UI 모음: photo viewer, etc>
http://github.com/facebook/three20 (초기에는 facebook 어플이었으나 현재는 여러 UI 모음으로 바뀜 )

<map>

<E-mail>
 
 
<달력>
http://ved-dimensions.blogspot.com/2009/04/iphone-development-creating-native_09.html

<sqlite>

<계산기>

<트위터 클라이언트>
http://github.com/blog/329-natsuliphone-iphone-twitter-client
http://code.google.com/p/tweetero/

<facebook>

<rss reader>
http://code.google.com/p/iphone-simple-rss-aggregator/

<ebook reader>
http://code.google.com/p/iphoneebooks/

<blog>
http://iphone.wordpress.org/

<백업, 동기화>
http://www.funambol.com/solutions/iphone.php
http://code.google.com/p/gris/ (구글 리더 동기화)

<time tracking>
http://github.com/freshbooks-addons/freshbooks-iphone-project

<게임>
http://code.google.com/p/cocos2d-iphone/
http://code.google.com/p/tris/ (테트리스)
http://code.google.com/p/mintgostop/ (고스톱)

 

<google toolbox>

http://code.google.com/p/google-toolbox-for-mac/


<택배>

 

<이미지 프로세싱>

http://code.google.com/p/simple-iphone-image-processing/


<증강현실>
http://www.iphonear.org/

<coverflow 대체 구현>
http://apparentlogic.com/openflow/
http://www.chaosinmotion.com/flowcover.m (매가박스 어플에서 참고함)

<정규표현식 라이브러리>
http://blog.mro.name/2009/09/cocoa-wrapped-regexh/
http://regexkit.sourceforge.net/RegexKitLite/

<라이브러리 : JSON, DOM XML, Google Data APIs, Twitter, Flick, Game Engines, Unit Testr>
http://www.codingventures.com/2008/12/useful-open-source-libraries-for-iphone-development/

<기타>
http://open.iphonedev.com/
http://joehewitt.com/post/the-three20-project/
posted by Sunny's
2010. 9. 2. 15:10 IPhone

http://maniacdev.com/2010/06/35-open-source-iphone-app-store-apps-updated-with-10-new-apps/

1. ABC 123Sequence memorization game. Utilizes Cocos2D. (itunes link) (source code)

*2. ArtificeStrategy game where you try to get to the other side by moving boxes out of the way. Utilizes Cocos2D. (itunes link) (source code)

3. ColloquyConversion of the most popular Mac IRC client to the iPhone. (itunes link) (source code)

*4. Countitout - A generic counting app. (itunes link) (source code)

5. Diceshaker - Dice rolling simulator designed for role-playing game enthusiasts. (itunes link) (source code)

6. Doom Classic - Classic 3D first person shooter. (itunes link) (source code) (build instructions)

*7. Ecological Footprint Calculate, display, and record your ecological footprint. (itunes link) (source code)

8. Fosdem - Calendar app for the Fosdem open source conference. (itunes link) (source code)

9. FreshbooksApp that enables usage of Freshbooks web invoicing software from your iPhone. (itunes link) (source code)

10. GorillasClassic Worms/iShoot turn based shooter type game converted to iPhone from basic. Utilizes Cocos2D. (itunes link) (source code). 1249ouFh83XA

11. Go Go LottoOpen source lotto ticket generator. (itunes link) (source code)

12. iStrobeTurns the iPhone 4 flash into a highly configurable strobe light. (itunes link) (source code)

13. Last.fmSoftware that enables usage of the Last.fm platform for personal radio stations. (itunes link) (source code)

14. Mobilesynth - A monophonic synthesizer designed for live performance. (itunes link) (source code)

15. MoleculesAllows you to view 3D models of molecules and manipulate them through touch. (itunes link) (source code)

16. MoverAllows you to transfer stuff from one iPhone to another by “flicking” it to the other device. (itunes link) (source code)

17. Natsulion - A basic twitter client converted from mac. (itunes link) (source code)

18. NowPlayingAllows you to check local theater listings, and check rotten tomato ratings. (itunes link) (source code)

19. PacklogBackpack journal client. (itunes link) (source code)

20. PlainNoteSimple Open Source Notepad. (itunes link) (source code)

21. PocketFlixFind movies, and manage your Netflix information. (itunes link) (source code)

22. NevoChessA Xiangqi game. (itunes link) (source code)

23. reMailE-mail client featuring ultra-fast search. Removed from app store, but source made available. (source code)

24. RobotFindsKittenPort of a very silly “classic” ASCII game. (itunes link) (source code)

25. Sci-15 HPCalcCalculator app based on classic scientific HP-Calculator. (itunes link) (source code)

26. SpaceBubbleSpace game featuring core graphics, and accelerometer usage. (itunes link) (source code)

27. Star3MapAugmented reality star and planet charting application. (itunes link) (source code)

28. Task CoachPersonal to-do list and task manager. (itunes link) (source code)

29. TubestatusLondon train schedule tracker. (itunes link) (source code)

30. TweejumpPlatform jumping game inspired by Icy Tower. Utilizes Cocos2D. (itunes link) (source code)

31. TweeteeEnhanced version of the Natsulion Twitter Client. (itunes link) (source code)

32. TweeteroBasic twitter client with image uploading. (itunes link) (source code)

33. TwitterfonSuper-fast intuitive twitter client. (itunes link) (source code)

34. ViralFireUnique game where you are a dodging blood cell. (itunes link) (source code)

35. WikihowA reader app for the popular how to wiki site. (itunes link) (source code)

36. Wolfenstein 3D Classic Platinum – If you haven’t heard of Wolfenstein post below so we can say a prayer for you. (itunes link) (source code)

37. WordPressClient for managing WordPress blogs. Also has an iPad version. (itunes link) (source code)

38. YourRightsPocket database containing a summary of your legal rights. (itunes link) (source code)

39. ZBarA barcode reader. (itunes link) (source code)

posted by Sunny's
2010. 9. 2. 11:27 Mac

세계적으로 회자되는 음악 서비스를 3개 꼽으라면 미국의 iTunes, Pandora 및 영국의 Spotify 를 들 수 있을 것 같다.

iTunes는 Gift Card를 사용해서 미 음원들을 불편없이 바로 구매할 수 있으나, 장르별 라디오 서비스라고 볼 수 있는 Pandora는 라이센스 문제로 미국 지역에서만 청취가 가능하게 되어, 한국에서는 서비스 이용이 불가능하였다. ( Spotify도 영국에서만 된다. ) 한국에서는 맥에서는 유일하게 소리바다가 스트리밍 서비스를 제공해주지만, 사용자가 좋아하는 가수 혹은 노래를 선택하면 유사한 풍의 음악을 틀어주는 Pandora 류의 서비스가 없었다.

Pandora 서비스를 국내의 맥 및 아이폰에서 사용할 수 있는 방법을 공유하고자 한다. 순서는 다음과 같다.

1. Mac 혹은 iPhone에서 VPN 설정한다. (미국서버로)

2. VPN 서비스를 킨다.

3. 국내에서 미국에만 제한되어 있는 Pandora 음악을 듣는다.

■■■ Mac 설정■■■

1. Mac 혹은 iPhone에서 VPN 설정한다.

- http://hotspotshield.com/ 에서 프로그램을 다운로드 받는다.

hotspotshield-01.png

2. VPN 서비스를 켠다.

- Application 폴더에 설치된 “Hotspot Shield”를 실행시키면, 메뉴바에 해당 실행메뉴가 실행된다.

201004171654.jpg

- Hotspot Shield 메뉴 아이콘을 클릭하면 Connect를 누르면 인증과정을 거친 후 연결되었다는 문구가 표시되면 완료된다.

hotspotshield-02.png hotspotshield-02-2.png

3. 국내에서 미국에만 제한되어 있는 Pandora 음악을 듣는다.

- Safari나 Firefox, Chrome 등의 브라우져를 켜서 Pandora에 접속한다. http://www.pandora.com/

- 계정이 없으면 새로 생성을하고, 새 Station을 만들면 해당 곡이 플레이 된 후 유사한 풍의 음악이 계속 흘러 나온다.

hotspotshield-03.png

즐음 하시길…

PS#1. 판도라 서비스 안내는 다음 글을 참고하세요. Pandora…내 취향을 알아주는 인터넷 라디오

PS#2. Hotspot Shield가 켜진상태에서는 네트워크가 미국을 경유해서 오고가기때문에, 사용하는 체감 인터넷 속도가 느려집니다.

■■■ iPhone/iPad 설정■■■

아이폰/iPad도 VPN을 통해서 접속하는 형태로 하면 된다.

1. 우선 Pandora 앱(무료)을 설치해서, 앞서 설정한 계정 정보를 입력한다.

Pandora for iPhone : http://itunes.apple.com/us/app/pandora-radio/id284035177?mt=8

2. iPhone의 네트워크에서 VPN 설정한다.

- Hotspot Shield의 아이폰 VPN 설정 페이지에서 “Get Started” 버튼을 클릭한다. http://hotspotshield.com/clientless/iphone/

Screen shot 2010-04-17 at 4.50.28 PM.png

- Settings -> General -> Network -> VPN -> Add VPN Configuration 에서 위에서 받은 VPN 정보를 입력한다.

vpn01.png

3. VPN 서비스를 킨다.

- Settings에 있는 VPN 서비스를 킨다. 인증이 성공하면 상단에 “VPN” 마크가 표시된다.

vpn03.png

4. 국내에서 미국에만 제한되어 있는 Pandora 음악을 듣는다.

- Pandora App을 실행시켜서 Station을 듣는다.

국내의 소리바다, 벅스뮤직 도 맥을 지원해주면서 Pandora 및 Spotify와 같은 SNS 혹은 유저 성향 기반의 음악 서비스를 좀 더 강화해주었으면 좋겠다.

출처 : http://tykim.wordpress.com/2010/04/17/%ed%95%9c%ea%b5%ad%ec%97%90%ec%84%9c-mac%ec%9c%bc%eb%a1%9c-pandora-%ec%9d%8c%ec%95%85-%eb%93%a3%ea%b8%b0/

posted by Sunny's
2010. 9. 1. 16:27 IPhone

1. Project Requirements

I suggest that you have at least a basic understanding of SQLite, writing SQL statements, the XCode interface and using the terminal in OSX. If you don’t know anything about any of these topics then this tutorial probably isn’t for you.

2. Creating our SQLite database for our tutorial

We first need to create a database for use with our application. For the purposes of this tutorial we will be building a database of animals along with a little information on them and a picture.

Fire up a new Terminal window and make a new folder to store the database in, here are the commands I ran

cd /Users/lookaflyingdonkey/Documents
mkdir SQLiteTutorial
cd SQLiteTutorial
sqlite3 AnimalDatabase.sql

You should now be at a “sqlite” command prompt, this is where we will be building our database structure and entering some test data.

For our example we need the name of the animal, a short description and a link to an image. Follow the commands below to create the table and to enter some sample data.

CREATE TABLE animals ( id INTEGER PRIMARY KEY, name VARCHAR(50), description TEXT, image VARCHAR(255) );

INSERT INTO animals (name, description, image) VALUES ('Elephant', 'The elephant is a very large animal that lives in Africa and Asia', 'http://dblog.com.au/wp-content/elephant.jpg');
INSERT INTO animals (name, description, image) VALUES ('Monkey', 'Monkies can be VERY naughty and often steal clothing from unsuspecting tourists', 'http://dblog.com.au/wp-content/monkey.jpg');
INSERT INTO animals (name, description, image) VALUES ('Galah', 'Galahs are a wonderful bird and they make a great pet (I should know, I have one)', 'http://dblog.com.au/wp-content/galah.jpg');
INSERT INTO animals (name, description, image) VALUES ('Kangaroo', 'Well I had to add the Kangaroo as they are the essence of the Australian image', 'http://dblog.com.au/wp-content/kangaroo.jpg');

The first command will create the table with the required structure and the next four will insert some test data for us to work with. To ensure that you have entered the data correctly you can execute “SELECT * FROM animals;” and see if it returns the items above. Once you are confident that everything had been created successfully you can leave the sqlite command line by typing “.quit”.

3. Creating our Project

Now that our database is all ready to go we need to setup our X-Code project.

Start off by creating a new “Navigation-Based Application”.

Give your Project a name, I called mine “SQLiteTutorial”.

Now set your screen layout to how you prefer it, I suggest making the window as large as possible, and making the code view as tall as possible by dragging the horizontal slider to the top. This will allow you the most room to move when building your application.

Now its time to create the required classes and views for our application, we will start off by making our views.

Right Click on the “Resources” folder in the left hand pane and click “Add File”, we want to create a new “View XIB” under the “User Interfaces” group.

We now need to give it a name, to stick the Apple’s naming conventions we are going to call it “AnimalViewController.xib”, Now Click “Finish”.

Now we need to create two classes, the first one will represent an animal, right click on the “Classes” folder in the left hand pane, click “Add > New File…”, choose the “NSObject subclass” template under the “Cocoa Touch Classes” group and name it “Animal”.

The second class will be for our AnimalsViewController, right click on the “Classes” folder in the left hand pane, click “Add > New File…”, choose the “UIViewController subclass” under the “Cocoa Touch Classes” group and name it “AnimalViewController”.

4. Adding SQLite Framework and our Animal Database

Now that we have created all of our views and classes it is time to start the real grunt work.

First off we need to include the SQLite libraries so our application can utilise them. To do this you will need to right click on the “Frameworks” folder in the left hand pane, then click on “Add > Existing Frameworks…”, then navigate to “/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS2.0.sdk/usr/lib/” and double click the “libsqlite3.0.dylib” file. A popup will appear, just click “Add” and the library will be added to your project.

We also need to add our database we created earlier to the Resources folder, to do this simply right click on the “Resources” folder, click “Add > Existing Files…”, navigate to the location you created the database in then double click on the AnimalDatabase.sql file. Another popup will appear, just click add.

All done with the importing, time to code!

5. The Coding begins!

We are going to start the coding by building our “Animal” object, every animal will have 3 properties, a name, a description and an image URL.

Open up the “Animal.h” file from the “Classes” folder and edit its contents to look like below,

#import <UIKit/UIKit.h>

@interface Animal : NSObject {
	NSString *name;
	NSString *description;
	NSString *imageURL;
}

@property (nonatomic, retain) NSString *name;
@property (nonatomic, retain) NSString *description;
@property (nonatomic, retain) NSString *imageURL;

-(id)initWithName:(NSString *)n description:(NSString *)d url:(NSString *)u;

@end

Most of the above code should be pretty familiar to you, the only thing that may not be is the initWithName line, this line will allow us to create a new object with the required data, we could have used the default init function, but it will be easier for us to define our own.

Now we will actually have to implement the Animal Object, open up the “Animal.m” file and edit its contents to look like below:

#import "Animal.h"

@implementation Animal
@synthesize name, description, imageURL;

-(id)initWithName:(NSString *)n description:(NSString *)d url:(NSString *)u {
	self.name = n;
	self.description = d;
	self.imageURL = u;
	return self;
}
@end

The above code should be pretty easy to read as well, it basically stores the supplied data from the initWithName function and return the object (self).

Now its time to setup the Application delegate to access the database.

Open up the “SQLiteTutorialAppDelegate.h” and edit its contents to look like below:

#import <UIKit/UIKit.h>
#import <sqlite3.h> // Import the SQLite database framework

@interface SQLiteTutorialAppDelegate : NSObject  {

    UIWindow *window;
    UINavigationController *navigationController;

	// Database variables
	NSString *databaseName;
	NSString *databasePath;

	// Array to store the animal objects
	NSMutableArray *animals;
}

@property (nonatomic, retain) IBOutlet UIWindow *window;
@property (nonatomic, retain) IBOutlet UINavigationController *navigationController;
@property (nonatomic, retain) NSMutableArray *animals;

@end

What we are doing here is importing the SQLite database framework and creating some variables for storing the database details and an array of animal objects.

Now open up the “SQLiteTutorialAppDelegate.m” file and edit its contents to look like below:

#import "SQLiteTutorialAppDelegate.h"
#import "RootViewController.h"
#import "Animal.h" // Import the animal object header

@implementation SQLiteTutorialAppDelegate

@synthesize window;
@synthesize navigationController;
@synthesize animals; // Synthesize the aminals array

- (void)applicationDidFinishLaunching:(UIApplication *)application {
	// Setup some globals
	databaseName = @"AnimalDatabase.sql";

	// Get the path to the documents directory and append the databaseName
	NSArray *documentPaths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
	NSString *documentsDir = [documentPaths objectAtIndex:0];
	databasePath = [documentsDir stringByAppendingPathComponent:databaseName];

	// Execute the "checkAndCreateDatabase" function
	[self checkAndCreateDatabase];

	// Query the database for all animal records and construct the "animals" array
	[self readAnimalsFromDatabase];

	// Configure and show the window
	[window addSubview:[navigationController view]];
	[window makeKeyAndVisible];
}

- (void)applicationWillTerminate:(UIApplication *)application {
	// Save data if appropriate
}

- (void)dealloc {
	[animals release];
	[navigationController release];
	[window release];
	[super dealloc];
}

-(void) checkAndCreateDatabase{
	// Check if the SQL database has already been saved to the users phone, if not then copy it over
	BOOL success;

	// Create a FileManager object, we will use this to check the status
	// of the database and to copy it over if required
	NSFileManager *fileManager = [NSFileManager defaultManager];

	// Check if the database has already been created in the users filesystem
	success = [fileManager fileExistsAtPath:databasePath];

	// If the database already exists then return without doing anything
	if(success) return;

	// If not then proceed to copy the database from the application to the users filesystem

	// Get the path to the database in the application package
	NSString *databasePathFromApp = [[[NSBundle mainBundle] resourcePath] stringByAppendingPathComponent:databaseName];

	// Copy the database from the package to the users filesystem
	[fileManager copyItemAtPath:databasePathFromApp toPath:databasePath error:nil];

	[fileManager release];
}

-(void) readAnimalsFromDatabase {
	// Setup the database object
	sqlite3 *database;

	// Init the animals Array
	animals = [[NSMutableArray alloc] init];

	// Open the database from the users filessytem
	if(sqlite3_open([databasePath UTF8String], &database) == SQLITE_OK) {
		// Setup the SQL Statement and compile it for faster access
		const char *sqlStatement = "select * from animals";
		sqlite3_stmt *compiledStatement;
		if(sqlite3_prepare_v2(database, sqlStatement, -1, &compiledStatement, NULL) == SQLITE_OK) {
			// Loop through the results and add them to the feeds array
			while(sqlite3_step(compiledStatement) == SQLITE_ROW) {
				// Read the data from the result row
				NSString *aName = [NSString stringWithUTF8String:(char *)sqlite3_column_text(compiledStatement, 1)];
				NSString *aDescription = [NSString stringWithUTF8String:(char *)sqlite3_column_text(compiledStatement, 2)];
				NSString *aImageUrl = [NSString stringWithUTF8String:(char *)sqlite3_column_text(compiledStatement, 3)];

				// Create a new animal object with the data from the database
				Animal *animal = [[Animal alloc] initWithName:aName description:aDescription url:aImageUrl];

				// Add the animal object to the animals Array
				[animals addObject:animal];

				[animal release];
			}
		}
		// Release the compiled statement from memory
		sqlite3_finalize(compiledStatement);

	}
	sqlite3_close(database);

}

@end

Now I know that may look like a fair bit of code and it probably also looks quite scary! But really it is quite simple and I have tried to comment nearly every line to describe to you what the line does and why it is there.

The checkAndCreateDatabase function checks to see if we have already copied our database from the application bundle to the users filesystem (in their documents folder), if the database hasn’t already been created or it has been removed for some reason it will be recreated from the default database.

Next the readAnimalsFromDatabase function will make a connection to the database that is stored in the users documents folder, and then executes the SQL statement “SELECT * FROM animals”. It will then go through each row that is returned and it will extract the name, description and imageURL from the result and build an Animal object for each. You will see the “sqlite3_column_text” function used here, there are many more of these for returning other field types such as “sqlite3_column_int” for integers, “sqlite3_column_blob” for blobs or “sqlite3_column_value” to get an unknown value.

Now that we have the data in our array and we have it in our known format we are ready to start displaying it.

Open up the “RootViewController.m” file and edit the numberOfRowsInSection to look like the following:

SQLiteTutorialAppDelegate *appDelegate = (SQLiteTutorialAppDelegate *)[[UIApplication sharedApplication] delegate];
return appDelegate.animals.count;

What this does is it creates a link to the application delegate, and then the second line returns the size f the animals array in out Application delegate, this array was filled previously from the SQLite database.

Now in the cellForRowAtIndexPath function you will need at change it to look like the following:

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

    static NSString *CellIdentifier = @"Cell";

    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
    if (cell == nil) {
        cell = [[[UITableViewCell alloc] initWithFrame:CGRectZero reuseIdentifier:CellIdentifier] autorelease];
    }

    // Set up the cell
    SQLiteTutorialAppDelegate *appDelegate = (SQLiteTutorialAppDelegate *)[[UIApplication sharedApplication] delegate];
	Animal *animal = (Animal *)[appDelegate.animals objectAtIndex:indexPath.row];

	[cell setText:animal.name];
	return cell;
}

We pretty much just added 3 lines under the “// Set up the cell” line, the first one is the same as we added previously to access the application delegate. The second line creates a new Animal object based on the array from the application delegate, it will be used to create a row for each individual record in the database. On the final line we are just setting the text of the cell to the name field from the Animal object.

You can now run the program and you should see a table view with the 4 animals we added to the database, if you added more than my default animals you should see them in here as well.

We will now setup the AnimalViewController, open up the “AnimalViewController.h” file and edit its contents to below:

#import <UIKit/UIKit.h>

@interface AnimalViewController : UIViewController {
	IBOutlet UITextView *animalDesciption;
	IBOutlet UIImageView *animalImage;
}

@property (nonatomic, retain) IBOutlet UITextView *animalDesciption;
@property (nonatomic, retain) IBOutlet UIImageView *animalImage;

@end

What we are doing above is adding an outlet for the description and image for the Animal, we will use these later on when we link the view up.

Now open up the “AnimalViewController.m” file and add a synthesize call for for the description and image, this will go under the “@implementation AnimalViewController” line, like so:

#import "AnimalViewController.h"

@implementation AnimalViewController

@synthesize animalDesciption, animalImage;

Now it is time to make the detailed view page appear when you select a record. Open up the “AnimalViewController.xib” file from the resources folder and the interface builder should appear.

The first thing we need to do is to set the File’s Owner Class to AnimalViewController, this is done by selecting the “File’s Owner” item in the main window and then clicking Tools > Identity Inspector in the top menu, and then selecting AnimalViewController from the class dropdown.

Your inspector window should now look like this:

We are going to be using a UITextView for the description (as it will allow for word wrapping and scrolling in the case that the description is quite large) and a UIImageView to display the image. I have laid mine out like below:

Now that we have everything laid out it is time to link them all up, start by holding control and click+drag from the “File’s Owner” to the “View” objects, a little gray menu will appear and you will need to select view. Now hold control and click+drag from the “File’s Owner” to the UITextView in the layout window, you should see “animalDescription” in the popup list, select it. Repeat this process for the UIImageView and you should see animalImage appear, select it also.

Now save the interface and close the interface builder.

Nearly done! All we have to do now is to setup the code for when a user presses on a record in the table view.

Open up the “RootViewController.h” file and edit its contents to below:

#import <UIKit/UIKit.h>
#import "AnimalViewController.h"

@interface RootViewController : UITableViewController {
	AnimalViewController *animalView;
}

@property(nonatomic, retain) AnimalViewController *animalView; 

@end

We are creating an instance of the AnimalViewController to be used bu the RootViewController when a user presses on an item.

Now open up the “RootViewController.m” file and edit the top part of the file to look like below:

#import "RootViewController.h"
#import "SQLiteTutorialAppDelegate.h"
#import "Animal.h"

@implementation RootViewController
@synthesize animalView;

This will just synthesize the animalView that we just added.

First up lets set the default title of our view, to do this you need to uncomment the viewDidLoad function, and edit it to below:

- (void)viewDidLoad {
    [super viewDidLoad];
    // Uncomment the following line to add the Edit button to the navigation bar.
    // self.navigationItem.rightBarButtonItem = self.editButtonItem;

	self.title = @"My Zoo";
}

We also need to edit the didSelectRowAtIndexPath

function in this file, edit it to look like below:

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
    // Navigation logic -- create and push a new view controller
	SQLiteTutorialAppDelegate *appDelegate = (SQLiteTutorialAppDelegate *)[[UIApplication sharedApplication] delegate];
	Animal *animal = (Animal *)[appDelegate.animals objectAtIndex:indexPath.row];

	if(self.animalView == nil) {
		AnimalViewController *viewController = [[AnimalViewController alloc] initWithNibName:@"AnimalViewController" bundle:nil];
		self.animalView = viewController;
		[viewController release];
	}

	// Setup the animation
	[self.navigationController pushViewController:self.animalView animated:YES];
	// Set the title of the view to the animal's name
	self.animalView.title = [animal name];
	// Set the description field to the animals description
	[self.animalView.animalDesciption setText:[animal description]];
	// Load the animals image into a NSData boject and then assign it to the UIImageView
	NSData *imageData = [NSData dataWithContentsOfURL:[NSURL URLWithString:[animal imageURL]]];
	UIImage *animalImage = [[UIImage alloc] initWithData:imageData cache:YES];
	self.animalView.animalImage.image = animalImage;

}

What we are doing here is checking to see if the animalView object has already been created, if not then create it.

The next few lines are used to setup the animation (slide from right to left) and to set the actual data fields to those of the selected animal.

Now you should be ready to fire up the application and see it in all its glory.

You should see your windows looking like below.
 

5. Project Files

Here are the source files for this project: Download the project source files

If you have any questions or comments please feel free to post them here and I will try to get back to you ASAP. Also keep your eye out for my second part to the advanced RSS Reader tutorial, it will be using TouchXML, SQLite, UIWebview and more!

출처 : http://dblog.com.au/iphone-development-tutorials/iphone-sdk-tutorial-reading-data-from-a-sqlite-database/

posted by Sunny's
2010. 8. 27. 21:57 IPhone
에어 비디오의 추가기능 변환을 알아보겠습니다.ㅎ

에어비디오 실행후 공유 시킨 폴더에 들어가서 영화를 선택합니다.

영화를 선택하면 이와같은 화면이 나오는데..
밑줄친 곳을 클릭!!!!
또 클릭..
이제 인코딩을 하고 있습니다..
이 파일은 서버에 영화가 있는 폴더에 생성이 됩니다.
코딩이 완료되고...
다시 영화를 선택하면 코딩된 영화파일로 영화 감상이 가능합니다.ㅎ
에어비디오 2.2.4버전에서 코딩할때 자막도 함께 영화에 덮어집니다..다른 버전은 안해봐서 잘몰라요~~
아주 간단한하고 허접한 설명.ㅎㅎ

출처 : http://nrz6olzr.egloos.com/3824379
posted by Sunny's
2010. 8. 26. 11:05 IPhone


수많은 아이폰 게이머들이 고대해 왔던 아이폰용 악세서리인 iControlPad가 드디어 양산에 돌입한다고 합니다. 아이폰용 게임패드라 할 수 있는 이 제품은 버튼형 조작 시스템을 장착하였기 때문에 사용자가 자신의 아이폰을 더 정확히 조작할 수 있도록 도와준다고 합니다. 아직 주문을 받고 있지는 않지만 이 제품을 개발한 Craig Rothwell의 트위터를 통해 곧 주문 일정이 알려질 것이라고 합니다. 그리고 이번에는 단 3,000대만 생산된다고 합니다. 아마도 불티나게 팔려나가 곧 매진될 것으로 추측됩니다. 또한 Rothwell은 이 제품의 양쪽 단자 부분을 변경함으로써 아이폰 외 다른 휴대폰에서도 사용 가능한 게임패드를 개발할 것이라 약속하고 있습니다.

다음 페이지의 비디오로, 이 iControlPad의 디자인이 어떻게 변해왔는지를 확인해 보세요.

Via: Engadget
Source: iControlPad, @craigix (Twitter)

posted by Sunny's
2010. 8. 20. 01:32 IPhone
자신의 아이폰, 아이패드 혹은 아이팟터치를 아이튠스가 필요 없이 Finder에 직접 마운트하여 관리할 수 있는
유료 프로그램인 Phone Disk 9월1일까지 한시적으로 무료로 배포되고 있습니다.

무료 다운로드 링크 : 여기
액티베이션 코드 : 2H96A-QK7MX-8GEYK1V-ZR6S8 (프로그램 실행 후 이 코드 입력하면 정식 등록)
프로그램 사이트 : http://www.macroplant.com/phonedisk/
                          (웹사이트 상단 Apps 메뉴에 기타 윈도/맥용 유용한 무료 프로그램이 있으니 참조)

기본 기능

  • 순정 및 탈옥 상태 모두 지원
  • 아이폰, 아이패드, 아이팟터치를 Finder에 마운트 가능 (동시에 복수 기기도 가능)
  • 복사, 이동, 저장 등을 지원하여 아이튠스 필요 없이 직접 파일 관리 




작성자의 카페글 더보기

posted by Sunny's
prev 1 2 next