반응형

반응형

“설령 고약한 이웃이 있더라도 그저 너는
더 좋은 이웃이 되려고 노력해야 하는 거야.
착한 아들을 원한다면 먼저 좋은 아빠가 되는 거고,
좋은 아빠를 원한다면 먼저 좋은 아들이 되어야겠지.
남편이나 아내, 상사 부하직원의 경우도 마찬가지야.
간단히 말해서 세상을 바꾸는 단 한 가지 방법은
바로 자신을 바꾸는 거야.


- ‘어린왕자, 두 번째 이야기’에서

반응형
Posted by 컴스터
,
반응형

장애물을 보는 사람은 많지만
목표를 보는 사람은 적다.
역사는 후자의 공로를 후세에 남기지만
전자에게 돌아가는 보상은 세인의 망각이다.


- 알프레드 아르망 몽타페르 (Alfred Armond Montapert)

반응형
Posted by 컴스터
,
반응형
NSArray *allAttributeKeys = [[[instance1 entity] attributesByName] allKeys];

if([[instance1 entity] isEqual:[instance2 entity]]
&& [[instance1 committedValuesForKeys:allAttributeKeys] isEqual:[instance2 committedValuesForKeys:allAttributeKeys]]) {
  // instance1 "==" instance2
}


반응형
Posted by 컴스터
,

유니코드 심벌

IPHONE 2014. 3. 13. 15:19
반응형

Here are some other symbols:

enter image description here

@"\u2611", @"\u2B1C", @"\u2705", @"\u26AB", @"\u26AA", @"\u2714", @"\U0001F44D", @"\U00


반응형
Posted by 컴스터
,
반응형

// 스크롤뷰 델리게이트

- (void)scrollViewDidScroll:(UIScrollView *)scrollView
{
    CGFloat pageWidth = scrollView.bounds.size.width;
    NSInteger pageNumber = floor((scrollView.contentOffset.x - pageWidth / 2) / pageWidth) + 1;
    self.pageControl.currentPage = pageNumber;
}

반응형

'IPHONE' 카테고리의 다른 글

코어 데이타 같은지 비교하기  (0) 2014.03.13
유니코드 심벌  (0) 2014.03.13
테이블뷰 위에 검색창 붙이는 방법  (0) 2014.03.05
툴바 버튼 토글 하기.  (0) 2014.03.04
NSUserDefaults 사용하기.  (0) 2014.02.18
Posted by 컴스터
,
반응형

테 이블뷰 위에 검색창 넣으신 후에

viewDidLoad 메서드 부분에

[table setContentOffset:CGPointMake(0.0, 44.0) animated:NO];

해주시면 처음 보여질 때는 검색창이 안 보이다가 밑으로 땡기면 나타나게 됩니다.

반응형

'IPHONE' 카테고리의 다른 글

유니코드 심벌  (0) 2014.03.13
UIScrollView 에 놓은 UIPageControl 에 스크롤시 현재 페이지 표시하기.  (0) 2014.03.05
툴바 버튼 토글 하기.  (0) 2014.03.04
NSUserDefaults 사용하기.  (0) 2014.02.18
배열 정렬하기.  (0) 2014.02.17
Posted by 컴스터
,
반응형

NSMutableArray *toolbarButtons = [self.toolbarItems mutableCopy];

// 툴바 버튼 숨기기.   
[toolbarButtons removeObject:self.bbi_cancel];
[self setToolbarItems:toolbarButtons animated:YES];


// 툴바 버튼 보이기.

if (![toolbarButtons containsObject:self.bbi_cancel])

{

[toolbarButtons addObject:self.bbi_cancel];

[self setToolbarItems:toolbarButtons animated:YES];

}


반응형
Posted by 컴스터
,
반응형

// 저장하기.

 NSUserDefaults *userDefaults = [NSUserDefaults standardUserDefaults];
 [userDefaults setObject:@"Hong Kil Dong" forKey:@"name"];
 [userDefaults synchronize];


// 불러오기.

NSUserDefaults *userDefaults = [NSUserDefaults standardUserDefaults];
NSString *name = [userDefaults objectForKey:@"name"];
if (name == nil)

{
     NSLog(@"No previous name saved");
}
else
{
    NSLog(@"Saved name: %@", name);
 }

반응형

'IPHONE' 카테고리의 다른 글

테이블뷰 위에 검색창 붙이는 방법  (0) 2014.03.05
툴바 버튼 토글 하기.  (0) 2014.03.04
배열 정렬하기.  (0) 2014.02.17
스타일 적용하기 예제.  (0) 2014.02.14
prepareForSegue 사용하기.  (0) 2014.02.12
Posted by 컴스터
,

배열 정렬하기.

IPHONE 2014. 2. 17. 11:37
반응형

NSMutableArray *arrayData = [NSMutableArray array];


// 배열에 입력 하는 코드 오는 곳.


// 정렬 조건.

NSSortDescriptor *sortDescriptor = [[NSSortDescriptor alloc] initWithKey:@"name" ascending:YES];
NSArray *sortDescriptors = [NSArray arrayWithObject:sortDescriptor];


[arrayData sortUsingDescriptors:sortDescriptors];

반응형

'IPHONE' 카테고리의 다른 글

툴바 버튼 토글 하기.  (0) 2014.03.04
NSUserDefaults 사용하기.  (0) 2014.02.18
스타일 적용하기 예제.  (0) 2014.02.14
prepareForSegue 사용하기.  (0) 2014.02.12
아이콘에 대한 설명  (0) 2014.02.08
Posted by 컴스터
,
반응형

// StyleSheet.h

#import <Foundation/Foundation.h>

typedef enum : int
{
    LabelTypeName = 0,
    LabelTypeBirthdayDate,
    LabelTypeDaysUntilBirthday,
    LabelTypeDaysUntilBirthdaySubText,
    LabelTypeLarge
}LabelType;

@interface StyleSheet : NSObject

+ (void)styleLabel:(UILabel *)label withtype:(LabelType)labelType;
+ (void)styleRoundCorneredView:(UIView *)view;

+ (void)initStyles;
+ (void)styleTextView:(UITextView *)textView;

@end


// StyleSheet.m

#import "StyleSheet.h"
#import <QuartzCore/QuartzCore.h>
#import "BlueButton.h"
#import "RedButton.h"

#define kFontLightOnDarkTextColor [UIColor colorWithRed:255.0/255 green:251.0/255 blue:218.0/255 alpha:1.0]
#define kFontDarkOnLightTextColor [UIColor colorWithRed:1.0/255 green:1.0/255 blue:1.0/255 alpha:1.0]

#define kFontNavigationTextColor [UIColor colorWithRed:106.f/255.f green:62.f/255.f blue:39.f/255.f alpha:1.f]
#define kFontNavigationDisabledTextColor [UIColor colorWithRed:106.f/255.f green:62.f/255.f blue:39.f/255.f alpha:0.6f]
#define kNavigationButtonBackgroundColor [UIColor colorWithRed:255.f/255.f green:245.f/255.f blue:225.f/255.f alpha:1.f]
#define kToolbarButtonBackgroundColor [UIColor colorWithRed:39.f/255.f green:17.f/255.f blue:5.f/255 alpha:1.f]
#define kLargeButtonTextColor [UIColor whiteColor]

#define kFontNavigation [UIFont fontWithName:@"HelveticaNeue-Bold" size:18.f]
#define kFontName [UIFont fontWithName:@"HelveticaNeue-Bold" size:15.f]
#define kFontBirthdayDate [UIFont fontWithName:@"HelveticaNeue" size:13.f]
#define kFontDaysUntilBirthday [UIFont fontWithName:@"HelveticaNeue-Bold" size:25.f]
#define kFontDaysUntilBirthdaySubText [UIFont fontWithName:@"HelveticaNeue" size:9.f]
#define kFontLarge [UIFont fontWithName:@"HelveticaNeue-Bold" size:17.f]
#define kFontButton [UIFont fontWithName:@"HelveticaNeue-Bold" size:30.f]
#define kFontNotes [UIFont fontWithName:@"HelveticaNeue" size:16.f]
#define kFontPicPhoto [UIFont fontWithName:@"HelveticaNeue-Bold" size:12.f]
#define kFontDropShadowColor [UIColor colorWithRed:1.0/255 green:1.0/255 blue:1.0/255 alpha:0.75]

@implementation StyleSheet

+(void)styleLabel:(UILabel *)label withtype:(LabelType)labelType
{
    switch (labelType)
    {
        case LabelTypeName:
            label.font = kFontName;
            label.layer.shadowColor = kFontDropShadowColor.CGColor;
            label.layer.shadowOffset = CGSizeMake(1.0f, 1.0f);
            label.layer.shadowRadius = 0.0f;
            label.layer.masksToBounds = NO;
            label.textColor = kFontLightOnDarkTextColor;
            break;
        case LabelTypeBirthdayDate:
            label.font = kFontBirthdayDate;
            label.textColor = kFontLightOnDarkTextColor;
            break;
        case LabelTypeDaysUntilBirthday:
            label.font = kFontDaysUntilBirthday;
            label.textColor = kFontDarkOnLightTextColor;
            break;
        case LabelTypeDaysUntilBirthdaySubText:
            label.font = kFontDaysUntilBirthdaySubText;
            label.textColor = kFontDarkOnLightTextColor;
            break;
        case LabelTypeLarge:
            label.textColor = kFontLightOnDarkTextColor;
            label.layer.shadowColor = kFontDropShadowColor.CGColor;
            label.layer.shadowOffset = CGSizeMake(1.0f, 1.0f);
            label.layer.shadowRadius = 0.0f;
            label.layer.masksToBounds = NO;
            break;
           
           
        default:
            label.textColor = kFontLightOnDarkTextColor;
            break;
    }
}

+ (void)styleRoundCorneredView:(UIView *)view
{
    view.layer.cornerRadius = 4.f;
    view.layer.masksToBounds = YES;
    view.clipsToBounds = YES;
}

+ (void)initStyles
{
    // 내비게이션 바.
    NSDictionary *titleTextAttributes = [NSDictionary dictionaryWithObjectsAndKeys:kFontNavigationTextColor, UITextAttributeTextColor,
                                         [UIColor whiteColor], UITextAttributeTextShadowColor,
                                         [NSValue valueWithUIOffset:UIOffsetMake(0, 2)], UITextAttributeTextShadowOffset,
                                         kFontNavigation, UITextAttributeFont, nil];
   
    [[UINavigationBar appearance] setTitleTextAttributes:titleTextAttributes];
   
    //  배경 이미지로 설정.
    [[UINavigationBar appearance] setBackgroundImage:[UIImage imageNamed:@"navigation-bar-background.png"] forBarMetrics:UIBarMetricsDefault];
   
    NSDictionary *barButtonItemTextAttributes;
   
    // 내비게이션 버튼.
   
    // 내비게이션 버튼 배경의 색상.
    [[UIBarButtonItem appearanceWhenContainedIn:[UINavigationBar class], nil] setTintColor:kNavigationButtonBackgroundColor];
   
    barButtonItemTextAttributes = [NSDictionary dictionaryWithObjectsAndKeys:
                                   kFontNavigationTextColor, UITextAttributeTextColor,
                                   [UIColor whiteColor], UITextAttributeTextShadowColor,
                                   [NSValue valueWithUIOffset:UIOffsetMake(0, 1)], UITextAttributeTextShadowOffset, nil];
   
    [[UIBarButtonItem appearanceWhenContainedIn:[UINavigationBar class], nil] setTitleTextAttributes:barButtonItemTextAttributes forState:UIControlStateNormal];
   
    NSDictionary *disabledBarButtonItemTextAttributes = [NSDictionary dictionaryWithObjectsAndKeys:
                                                         kFontNavigationDisabledTextColor, UITextAttributeTextColor,
                                                         [UIColor whiteColor], UITextAttributeTextShadowColor,
                                                         [NSValue valueWithUIOffset:UIOffsetMake(0, 1)], UITextAttributeTextShadowOffset, nil];
   
    [[UIBarButtonItem appearanceWhenContainedIn:[UINavigationBar class], nil] setTitleTextAttributes:disabledBarButtonItemTextAttributes forState:UIControlStateDisabled];
   
    // 툴바.
    // 툴바  배경 이미지.
    [[UIToolbar appearance] setBackgroundImage:[UIImage imageNamed:@"tool-bar-background.png"] forToolbarPosition:UIToolbarPositionAny barMetrics:UIBarMetricsDefault];
   
    // 툴바 버튼
    // 툴바 버튼에 어두운 배경 적용.
    // 툴바 버튼 배경색.
    [[UIBarButtonItem appearanceWhenContainedIn:[UIToolbar class], nil] setTintColor:kToolbarButtonBackgroundColor];
   
    // UIBarButtonItem에 흰색 텍스트 적용.
    barButtonItemTextAttributes = [NSDictionary dictionaryWithObjectsAndKeys:[UIColor whiteColor], UITextAttributeTextColor, nil];
   
    [[UIBarButtonItem appearanceWhenContainedIn:[UIToolbar class], nil] setTitleTextAttributes:barButtonItemTextAttributes forState:UIControlStateNormal];
   
    // 버튼.
    [[BRBlueButton appearance] setBackgroundImage:[UIImage imageNamed:@"button-blue.png"] forState:UIControlStateNormal];
    [[BRBlueButton appearance] setTitleColor:kLargeButtonTextColor forState:UIControlStateNormal];
   
    [[BRRedButton appearance] setBackgroundImage:[UIImage imageNamed:@"button-red.png"] forState:UIControlStateNormal];
    [[BRRedButton appearance] setTitleColor:kLargeButtonTextColor forState:UIControlStateNormal];
   
    [[BRRedButton appearance] setFont:kFontLarge];
   
    // 테이블 뷰.
    [[UITableView appearance] setBackgroundColor:[UIColor clearColor]];
    [[UITableViewCell appearance] setSelectionStyle:UITableViewCellSelectionStyleNone];
    [[UITableView appearance] setSeparatorStyle:UITableViewCellSeparatorStyleNone];
   
}

+ (void)styleTextView:(UITextView *)textView
{
    textView.backgroundColor = [UIColor clearColor];
    textView.font = kFontNotes;
    textView.textColor = kFontLightOnDarkTextColor;
    textView.layer.shadowColor = kFontDropShadowColor.CGColor;
    textView.layer.shadowOffset = CGSizeMake(1.0f, 1.0f);
    textView.layer.shadowRadius = 0.0f;
    textView.layer.masksToBounds = NO;
}

@end


반응형

'IPHONE' 카테고리의 다른 글

NSUserDefaults 사용하기.  (0) 2014.02.18
배열 정렬하기.  (0) 2014.02.17
prepareForSegue 사용하기.  (0) 2014.02.12
아이콘에 대한 설명  (0) 2014.02.08
iOS 6에서 오토 레이아웃 시작하기. 파트 2  (0) 2014.02.08
Posted by 컴스터
,


반응형