MBProgressHUD

iOS/Skills 2010. 7. 21. 19:54

원본: http://github.com/jdg/MBProgressHUD
출처: http://www.devpia.com/MAEUL/Contents/Detail.aspx?BoardID=7462&MAEULNO=911&no=52297&page=1


MBProgressHUD

MBProgressHUD is an iPhone drop-in class that displays a translucent HUD with a progress indicator and some optional labels while work is being done in a background thread. The HUD is meant as a replacement for the undocumented, private UIKit UIProgressHUD with some additional features.

 

Adding MBProgressHUD to your project

The simplest way to add the MBProgressHUD to your project is to directly add the MBProgressHUD.h and MBProgressHUD.m source files to your project.

  1. Download the latest code version from the repository (you can simply use the Download Source button and get the zip or tar archive of the master branch).
  2. Extract the archive.
  3. Open your project in Xcode, than drag and drop MBProgressHUD.h and MBProgressHUD.m to your classes group (in the Groups & Files view).
  4. Make sure to select Copy items when asked.

Usage

A full Xcode demo project is included in the Demo directory. This should give you an idea how to use the class.

Posted by 독뽀
,
출처: http://www.devpia.com/MAEUL/Contents/Detail.aspx?BoardID=7462&MAEULNO=911&no=52201&page=1

UIBarButtonSystemItem은 아래 링크와 같이 정의되어 있음(사파리에서 제대로 보임)

http://developer.apple.com/iphone/library/documentation/UIKit/Reference/UIBarButtonItem_Class/Reference/Reference.html#//apple_ref/doc/uid/TP40007519-CH3-SW2

 

 

위 그림과 같이 100부터 문서화 되지 않은 아이템이 있음

 

 Value

Image name 

100

UIButtonBarLocate.png

101

UIButtonBarArrowLeft.png

102

UIButtonBarArrowRight.png

103

UIButtonBarArrowUp.png

104

UIButtonBarArrowDown.png

105

UIButtonBarArrowLeft.png

106

UIButtonBarArrowRight.png

107

UIButtonBarPreviousSlide.png

108

UIButtonBarNextSlide.png

109

UIButtonBarPageCurl***.png

 

 

UIBarButtonItem *buttonItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:(UIBarButtonSystemItem)107 target:self action:NULL];

 

이런식으로 쓰면 됨.

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

UIAlertView without Buttons - Please Wait Dialog  (0) 2010.07.21
MBProgressHUD  (0) 2010.07.21
UIAlertView 커스터마이징  (0) 2010.07.21
UIImage 마스크(스텐실) 효과 주기 - Core Graphics  (0) 2010.07.21
UINavigationBar 커스터마이징  (0) 2010.07.21
Posted by 독뽀
,

원본: http://joris.kluivers.nl/iphone-dev/?p=CustomAlert
출처: http://www.devpia.com/MAEUL/Contents/Detail.aspx?BoardID=7462&MAEULNO=911&no=51914&page=1

iPhone SDK는 사용자에게 팝업을 보여주기 위한 UIAlertView 클래스를 제공합니다. 예를 들어, 애플은 이 팝업을 문자 메시지가 도착했을 때 사용합니다. 어플리케이션 개발자들은 이와 같은 팝업을 사용할 수 있습니다. 최상위의 특수한 윈도우 레벨에 보여집니다. 팝업 아래의 컨텐츠들에 대한 사용자의 입력은 팝업이 사라질 때까지 무시됩니다.


나의 최근 프로젝트들 중, 하나의 뷰가 모든 다른 컨텐츠들의 최상위에 보여져야만 했습니다. Spotlight dim effect와 사용자 입력을 막는 것은 재사용할 수 있었으나, 파란색의 UIAlertView 스타일은 나의 요구와 맞지 않았습니다. 처음부터 나만의 뷰를 만드는 대신, UIAlertView가 제공하는 것을 재사용하고 모든 불필요한 기능들을 제거하기로 결심했습니다.

이 페이지는 아래에 나온 피가 튀기는 것 같은 변형된 Alert를 생성하기 위해 무엇이 필요한지 설명할 것입니다.
 
A normal alert vs. a custom alert
 
팝업을 우리가 원하는 어떤 것으로든 변형할 수 있지만, 단순함을 유지하려고 했습니다. 피가 튀기는 팝업은 두 가지 주요 파트들로 구성되어져 있습니다. 배경 이미지와 텍스트 레이블. 위의 비교에서 볼 수 있듯이, 우리는 버튼과 기본 텍스트를 무시할 겁니다. 새로운 초기화 함수는 JKCustomAlert에게 정보를 제공하기 위해 사용될 것입니다.
 
- (id) initWithImage:(UIImage *)backgroundImage text:(NSString *)text;
 
자체 Initializer를 사용함으로써, 기본 타이틀과 메시지는 설정되지 않습니다. 만약 지금 시점에서 팝업을 보여준다면, 비어있고 작지만, 기본 모습을 가진 팝업이 나타날겁니다.

팝업의 배경을 기본에서 자체 배경으로 변경하기 위해서 drawRect: 는 Override 되어야 합니다. 우리가 해야할 것은 배경 이미지를 뿌리는 것 뿐입니다.

- (void) drawRect:(CGRect)rect {
    // do not call the super drawRect

    CGSize imageSize = self.backgroundImage.size;
    [self.backgroundImage drawInRect:CGRectMake(0, 0, imageSize.width, imageSize.height)];
}
 
마지막으로 할 것은 배경 이미지의 크기에 맞게 JKCustomAlert의 크기를 변경하는 것입니다. show 함수는 팝업의 크기를 재설정하고 애니메이션할 책임이 있습니다. 에니메이션을 시작하고 뷰의 크기를 맞추기 위해 super 함수를 호출합니다.
 
- (void) show {
    // call the super show method to initiate the animation
    [super show];

    // resize the alert view to fit the image
    CGSize imageSize = self.backgroundImage.size;
    self.bounds = CGRectMake(0, 0, imageSize.width, imageSize.height);
}
 
팝업에 나타나는 Text label은 addSubView: 함수에 추가되고, 위치는 layoutSubviews 함수 안에서 설정됩니다.

사용자에게 버튼을 제공하지 않기 때문에, dismissWithClickedButtonIndex:animated셀렉터를 사용하여 팝업을 수동으로 없애야 합니다. 그렇지 않으면, 프로그램은 팝업이 보이는 동안 멈추어 있을 것입니다.
 

Sample Project

Download CustomAlert.zip (23kb)

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

MBProgressHUD  (0) 2010.07.21
UIBarButtonSystemItem 추가된 아이템  (0) 2010.07.21
UIImage 마스크(스텐실) 효과 주기 - Core Graphics  (0) 2010.07.21
UINavigationBar 커스터마이징  (0) 2010.07.21
App Icon에 뱃지(Badge) 달기  (0) 2010.07.21
Posted by 독뽀
,
원본: http://iphonedevelopertips.com/general/remove-shine-gloss-effect-on-iphone-icon.html
출처: http://www.devpia.com/MAEUL/Contents/Detail.aspx?BoardID=7462&MAEULNO=911&no=51777&page=1

How to Mask an Image

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

UIBarButtonSystemItem 추가된 아이템  (0) 2010.07.21
UIAlertView 커스터마이징  (0) 2010.07.21
UINavigationBar 커스터마이징  (0) 2010.07.21
App Icon에 뱃지(Badge) 달기  (0) 2010.07.21
앱 아이콘 반사효과 없애기  (0) 2010.07.21
Posted by 독뽀
,

출처: http://www.devpia.com/MAEUL/Contents/Detail.aspx?BoardID=7462&MAEULNO=911&no=51676&page=1

아래와 같이 배경색을 바꿀 수 있습니다.

You can change background color of navigation bar like this.

[[controller navigationBar] setTintColor:[UIColor colorWithRed:0.36 green:0.09 blue:0.39 alpha:1.00]];

 

타이틀은 다음과 같이 지정할 수 있습니다.

You can set the title like this. 

CGRect frame = CGRectMake(0, 0, 400, 44);
UILabel *label = [[[UILabel alloc] initWithFrame:frame] autorelease];
label.backgroundColor = [UIColor clearColor];
label.font = [UIFont boldSystemFontOfSize:20.0];
label.shadowColor = [UIColor colorWithWhite:0.0 alpha:0];
label.textAlignment = UITextAlignmentCenter;
label.textColor = [UIColor blackColor];
label.text = navBar.topItem.title;
navBar.topItem.titleView = label;
Posted by 독뽀
,

출처: http://www.devpia.com/MAEUL/Contents/Detail.aspx?BoardID=7462&MAEULNO=911&no=51672&page=1

최근 수신한 메일이 있으면 iPhone, iPod touch 메일 아이콘에 빨간색 동그라미 안에 있는 숫자를 보실 수 있습니다.

최근 수신한 이메일 개수를 보여주기 위한 배지(Badge)인데, 최근 수신한 데이터나 최근 등록한 데이터가 있을 때 보여주게 하면 시각효과가 좋습니다.

방법은 아주 간단합니다.

You can see number inside circle in red when you've got email recently on iPhone, iPod touch mail application.
It calls "Badge" that shows quantity of your recent received email. If there are some new received data or registered data,
visual effect(for recognition) will be good.

How-to use the "Badge" is easy.

 

[[UIApplication sharedApplication] setApplicationIconBadgeNumber:99];

 

 

 

[[UIApplication sharedApplication] setApplicationIconBadgeNumber:123456];

 

 

Badge Number를 0으로 하면 뱃지가 사라집니다.

Setting "setApplicationIconBadgeNumber" to 0 (zero) will make disappeared the "Badge".

[[UIApplication sharedApplication] setApplicationIconBadgeNumber:0];

 

App을 종료하기 전에 위 코드를 실행해주면 종료후 iPhone 화면에 배지가 달린 아이콘을 보실 수 있습니다.

If you run above code before closing the application, you may see an icon with badge.

(추가)

위 내용은 델리게이트의 applicationWillTerminate: 메소드에 적용 시 iOS 4.0 이전에서는 이상이 없습니다.
4.0 이후라면 어플이 백그라운드로 진입 시 어떻게 할지 정한 후 (info.plist 파일에서 +누른 후 선택)
체크 한 경우에는 상관이 없고, (멀티 태스킹 미지원으로 설정)
체크 해제한 경우에는 어플이 백그라운드로 갈 때의 메소드에도 넣어주시면 됩니다. (멀티 태스킹 지원, 두 메소드 모두에 넣기)

(Addition)

Above article is for lower version than iOS 4.0 (support multi-tasking function).
Using higher iOS version(support multi-tasking function, after iOS 4.0), you must consider a matter in all its aspects whether you will use badge on multi-tasking environment.
You can set up on info.plist file. Add new option to info.plist on xcode by clicking + button.
Select Application does Not run in Background option.
Checking that option will not support multi-tasking, unchecking will support.
Checking that option is equal to this article, unchecking may make some code to application will run in background methods.

Posted by 독뽀
,

원본 : http://iphonedevelopertips.com/general/remove-shine-gloss-effect-on-iphone-icon.html
출처 : http://www.devpia.com/MAEUL/Contents/Detail.aspx?BoardID=7462&MAEULNO=911&no=51213&page=1

Remove Shine / Gloss Effect on iPhone Icon

Posted by 독뽀
,