'UIImage'에 해당되는 글 5건

  1. 2011.11.01 UIWebView 관련.
  2. 2011.10.28 Table View 관련
  3. 2011.09.29 아이폰 사진 관련.
  4. 2011.09.28 테이블 셀에서 사용할 때 UIImage 와 UILabel의 정렬.
  5. 2011.09.22 iOS에서 SQLite3에 이미지 저장하는 방법 : 링크

UIWebView 관련.

Dev/iOS 2011. 11. 1. 17:56


HTML 문자열로 표시할때 gif 이미지 표시하는 방법.
NSString *html = [NSString stringWithFormat:@"<img src='https://t1.daumcdn.net/cfile/tistory/2220894C56E7540A35", [myData base64Value];
[myWebView loadHTMLString:html baseURL:nil]
* 테스트 안됐음.


HTML 문자열로 표시할때 이미지를 파일로 저장한 후 해당 경로를 이용하여 표시하는 방법.

- (NSString *)writeToFile:(UIImage *)image
{
    // Get the location of the Documents directory
    NSArray * paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
 
   NSString * imagePath = [paths objectAtIndex:0];
    NSString * filename = @"tempDiaryPicture.png";
 
   NSString * filepath = [NSString stringWithFormat:@"%@/%@", imagePath, filename];
    
    // Save the image
    NSData *imageData = [NSData dataWithData:UIImagePNGRepresentation(image)];
 
   [imageData writeToFile:filepath atomically:YES];
    
    return filepath;
}
- (void)viewDidAppear:(BOOL)animated
{
    [super viewDidAppear:animated];
    Model * model = _getModel();
    NSString * html = [NSString stringWithFormat:
 
                      @"<center><img src=\"file://%@\" width=\"240\" height=\"240\" border=\"0\"></center>\n"
                       "<hr />",
                       [self writeToFile:image]];    // UIImage * image -> 데이터베이스나 라이브러리와 같은 곳에서 읽어온경우.
    [webView loadHTMLString:html
 
                    baseURL:nil];
    
 }
 

Base64 encoding options on the Mac and iPhone



stackoverflow : http://stackoverflow.com/questions/1527351/how-to-add-an-uiimage-in-mailcomposer-sheet-of-mfmailcomposeviewcontroller-in-ip
NSData+base64 by matt gallagher : http://cocoawithlove.com/2009/06/base64-encoding-options-on-mac-and.html 



간략하게 설명하면 다음과 같다.
1. matt gallagher 의 홈페이지에 가서 NSData_Base64.zip 파일을 다운로드 받아 프로젝트 폴더에 압축을 해제.
2. NSData+Base64.h, NSData+Base64.m 파일을 프로젝트에 추가한다.
3. 사용하고자 하는 파일에 .h 파일을 #import 한다.
4. 다음과 같이 UIImage파일을 NSData로 변환을 거쳐 NSString으로 변환하여 이미지를 표시한다.
 UIImage *emailImage = [UIImage imageNamed:@"myImageName.png"];
 
//Convert the image into data
   
NSData *imageData = [NSData dataWithData:UIImagePNGRepresentation(emailImage)];
 
//Create a base64 string representation of the data using NSData+Base64
   
NSString *base64String = [imageData base64EncodedString];
 
//Add the encoded string to the emailBody string
 
//Don't forget the "<b>" tags are required, the "<p>" tags are optional
   
[emailBody appendString:[NSString stringWithFormat:@"<p><b><img src='https://t1.daumcdn.net/cfile/tistory/233F704F56E7540A34",base64String]];




'Dev > iOS' 카테고리의 다른 글

gdb stack trace at 'putpkt: write failed' 해결방법  (0) 2011.11.11
NSLog 함수 이름 관련 매크로.  (0) 2011.11.04
UILabel 관련 내용.  (0) 2011.11.01
UITextView  (0) 2011.11.01
Table View 관련  (0) 2011.10.28
:

Table View 관련

Dev/iOS 2011. 10. 28. 18:21



테이블 배경에 패턴 형식으로 이미지 넣기.

NSString *backgroundPath = [[NSBundle mainBundle] pathForResource:@"background" ofType:@"jpg"];
UIImage *backgroundImage = [UIImage imageWithContentsOfFile:backgroundPath];
UIColor *backgroundColor = [[UIColor alloc] initWithPatternImage:backgroundImage];
self.tableView.backgroundColor = backgroundColor;
[backgroundColor release];


뷰 컨트롤러의 뷰 배경에 이미지 넣고 테이블 배경 투명하게 하기.


anniversaryTableView = [[AddAnniversaryTableViewController alloc]

initWithStyle:UITableViewStylePlain];

//테이블 뷰의 배경색을 투명으로 지정합니다.

anniversaryTableView.view.backgroundColor = [UIColor clearColor];

anniversaryTableView.view.opaque = YES;

anniversaryTableView.delegate = self;

anniversaryTableView.tableView.allowsSelectionDuringEditing = YES;

//뷰 컨트롤러의 뷰에 배경 이미지를 지정합니다.

self.view.backgroundColor =

[UIColor colorWithPatternImage:

[UIImageimageNamed:@"anniversary_background.png"]];

anniversaryTableView.view.frame = CGRectMake(9010230450);


//그리고 뷰 컨트롤러의 뷰 위에 테이블 뷰 컨트롤러의 뷰를 붙입니다.

[self.view addSubview:anniversaryTableView.view];






 

'Dev > iOS' 카테고리의 다른 글

UILabel 관련 내용.  (0) 2011.11.01
UITextView  (0) 2011.11.01
HTML5로 아이폰앱 만들기  (0) 2011.10.28
NSDate를 이용하여 D-Day 계산.  (0) 2011.10.28
iOS 텍스트 관련.  (0) 2011.10.24
:

아이폰 사진 관련.

Dev/iOS 2011. 9. 29. 16:24


라이브러리에 사용자 사진 추가하기.

UIImage * image = [UIImage imageNamed:@"picture.jpg"];
UIImageWriteToSavedPhotosAlbum(image, nil, nil, nil);


UIImagePickerController 클래스 사용법
미니의 프로그래밍 이야기 

 

'Dev > iOS' 카테고리의 다른 글

둥근 모서리 UIImageView 만들기  (0) 2011.09.30
iOS 모달뷰  (0) 2011.09.29
테이블 셀에서 사용할 때 UIImage 와 UILabel의 정렬.  (0) 2011.09.28
iOS Provisioning Profile 만료시 갱신법.  (0) 2011.09.27
xcode 버전 관리 기능.  (0) 2011.09.27
:

테이블 셀에서 사용할 때 UIImage 와 UILabel의 정렬.

Dev/iOS 2011. 9. 28. 20:03


'Dev > iOS' 카테고리의 다른 글

iOS 모달뷰  (0) 2011.09.29
아이폰 사진 관련.  (0) 2011.09.29
iOS Provisioning Profile 만료시 갱신법.  (0) 2011.09.27
xcode 버전 관리 기능.  (0) 2011.09.27
NSMutableArray 인스턴스에 접근시 EXC_BAD_ACCESS 발생.  (0) 2011.09.23
:

iOS에서 SQLite3에 이미지 저장하는 방법 : 링크

Dev/iOS 2011. 9. 22. 13:18


미니 님의 페이지 링크.
 
: