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
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
- (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
- (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が複数行になりません。 |
NewerOlder