This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
self.navigationController.navigationBar.barStyle = UIBarStyleBlack; | |
self.navigationController.navigationBar.tintColor = nil; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
self.navigationController.navigationBar.tintColor = [UIColor blackColor]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
self.navigationController.navigationBar.tintColor = nil; | |
self.navigationController.navigationBar.barStyle = UIBarStyleBlack; | |
self.navigationController.navigationBar.translucent = YES; | |
self.navigationController.navigationBar.backgroundColor = nil; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
for (UIView *view in self.navigationController.navigationBar.subviews) { | |
if ([[[view class] description] isEqualToString:@"UINavigationButton"]) { | |
[(UINavigationButton *)view setTintColor:newColor]; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#define FLIP_ANIMATION_DURATION 0.5 | |
static BOOL flipFromLeft = YES; | |
// secondViewを作る | |
if (flipFromLeft) { | |
secondView = ... // Flipして表示したいsecondViewにインスタンス割り当て(secondViewというメンバー変数があること) | |
} | |
// self.view -> secondViewへFlipして切り替える | |
[UIView transitionFromView:(flipFromLeft ? self.view : secondView) | |
toView:(flipFromLeft ? secondView : self.view) | |
duration:FLIP_ANIMATION_DURATION |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- (void)addNavigationBarButton { | |
// 黒色のNavigationBarに黒色のボタンの場合 | |
// setmentedControlObjectがメンバー変数としてあること | |
NSArray *controlItems = [NSArray arrayWithObjects:@"BBB", nil]; | |
segmentedControlObject = [[UISegmentedControl alloc] initWithItems:controlItems]; | |
segmentedControlObject.momentary = YES; | |
segmentedControlObject.segmentedControlStyle = UISegmentedControlStyleBar; | |
segmentedControlObject.tintColor = [UIColor darkGrayColor]; | |
[segmentedControlObject addTarget:self action:@selector(flipNavigationBarButton) forControlEvents:UIControlEventValueChanged]; | |
UIBarButtonItem *button = [[UIBarButtonItem alloc] initWithCustomView:segmentedControlObject]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// initでannotationクラスのcoordinateプロパティにINVALID_COORDINATEをセットしておき、 | |
// coordinateプロパティがまだセットされていない状態であることを示す。 | |
// | |
// if (CLLocationCoordinate2DIsValid(coordinate))で検証する | |
// | |
#define INVALID_LOCATION_DEGREE -1000 | |
#define INVALID_COORDINATE CLLocationCoordinate2DMake(INVALID_LOCATION_DEGREE, INVALID_LOCATION_DEGREE) | |
// 最低限の地図の大きさ | |
#define MINIMUM_MAP_SPAN MKCoordinateSpanMake(0.002, 0.002) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// なんか無駄な処理入ってる気がするが・・・、一応残しておく | |
#import "JSON.h" //JsonFramework | |
// JSONがNSDictionaryを持つ配列の場合 | |
- (void)something { | |
id *jsonResult = [result JSONValue]; | |
if (![jsonResult isKindOfClass:[NSArray class]]) return; | |
NSArray jsonArray = jsonResult; | |
for (id dic in jsonArray) { | |
[self setDistanceWithIdType:[[(NSDictionary *)dic objectForKey:@"firstKey"] objectForKey:@"secondKey"]]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// NSStringについてはnullとnilと空文字""を判定しないといけない。 | |
// [NSNull null]はシングルトンなのでisKindOfClass:[NSNull class]を使わずとも==[NSNull null]で判定可能。 | |
// nilと空文字については、length==0でどちらも判別できる。 | |
// | |
// (self == (id)[NSNull null] || self.length == 0) | |
// | |
// カテゴリで定義して | |
// NSString+MyCategory.h | |
@interface NSString (MyCategory) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** 使い方 sample usage */ | |
#define BUTTON_RADIUS 10.0f | |
#define BUTTON_BORDER_WIDTH 1.0f | |
NSString *title = @"something"; | |
UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom]; | |
button.frame = rect; | |
[button setTitle:title forState:UIControlStateNormal]; | |
[button setTitleColor:[UIColor redColor] forState:UIControlStateNormal]; | |
[button setBackgroundColor:[UIColor colorWithWhite:0.8 alpha:0.5] forState:UIControlStateNormal radius:BUTTON_RADIUS]; |
OlderNewer