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)viewDidLoad | |
{ | |
[super viewDidLoad]; | |
// UILabelの場合 | |
UILabel* myLabel = [[UILabel alloc] init]; | |
myLabel.text = @"Every great iOS app starts with a great idea, but translating that idea into actions requires some planning. Every iOS app relies heavily on design patterns, and those design patterns influence much of the code you need to write. So before you write any code, take the time to explore the possible techniques and technologies available for writing that code. Doing so can save you a lot of time and frustration."; | |
myLabel.font = [UIFont systemFontOfSize:12.0]; | |
myLabel.backgroundColor = [UIColor blueColor]; | |
myLabel.numberOfLines = 0; //これがないとUILabelが複数行になりません。 |
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)viewDidLoad | |
{ | |
[super viewDidLoad]; | |
//boundingRectWithSize:options:contextを使う | |
NSDictionary *attributes = @{ NSForegroundColorAttributeName : [UIColor whiteColor], | |
NSFontAttributeName : [UIFont systemFontOfSize:12.0f] }; | |
NSAttributedString *string = [[NSAttributedString alloc] initWithString:@"Every great iOS app starts with a great idea, but translating that idea into actions requires some planning. Every iOS app relies heavily on design patterns, and those design patterns influence much of the code you need to write. So before you write any code, take the time to explore the possible techniques and technologies available for writing that code. Doing so can save you a lot of time and frustration." | |
attributes:attributes]; |
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
CGRect newFrame = self.myTextView.frame; | |
newFrame.size.height = self.myTextView.contentSize.height; | |
self.myTextView.frame = newFrame; |
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
// (link MediaPlayer.framework) | |
// get item changed notification | |
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(changePlayerStatus:) name:MPMusicPlayerControllerNowPlayingItemDidChangeNotification object:nil]; | |
// get status changed notification | |
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(changePlayerStatus:) name:MPMusicPlayerControllerPlaybackStateDidChangeNotification object:nil]; | |
// get volume changed notification | |
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(changePlayerStatus:) name:MPMusicPlayerControllerVolumeDidChangeNotification object: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
[[NSNotificationCenter defaultCenter] | |
addObserver:self | |
selector:@selector(handleScreenCapture:) | |
name:UIApplicationUserDidTakeScreenshotNotification | |
object: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
ALAssetsGroup *group; | |
[group setAssetsFilter:onlyPhotosFilter]; | |
NSInteger lastPhotoIndex = [group numberOfAssets]; | |
NSMutableIndexSet* photoIndexes = [[NSMutableIndexSet alloc] init]; | |
[photoIndexes addIndex:lastPhotoIndex-1]; | |
[group enumerateAssetsAtIndexes:photoIndexes options:nil usingBlock:assetsEnumerationBlock]; |
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
ALAssetsLibrary* assetsLibrary = [[ALAssetsLibrary alloc] init]; | |
NSUInteger groupTypes = ALAssetsGroupSavedPhotos; | |
[assetsLibrary enumerateGroupsWithTypes:groupTypes usingBlock:listGroupBlock failureBlock:failureBlock]; |
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
// 韓国語 | |
int 사과 = 5; | |
int 바나나 = 3; | |
int 총 = 사과 + 바나나; | |
NSLog(@"총 %d",총); |
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
// タイ語 | |
int แอปเปิล = 5; | |
int กล้วย = 3; | |
int รวมทั้งหมด = แอปเปิล + กล้วย; | |
NSLog(@"รวมทั้งหมด %d",รวมทั้งหมด); | |
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
NSArray* クラス全員 = [[NSArray alloc] init]; | |
for( id 選ばれた人 in クラス全員){ | |
[選ばれた人 description]; | |
} |
OlderNewer