{"id":903,"date":"2010-12-21T17:27:46","date_gmt":"2010-12-21T08:27:46","guid":{"rendered":"http:\/\/yamazon.org\/?p=903"},"modified":"2010-12-21T17:27:46","modified_gmt":"2010-12-21T08:27:46","slug":"%e5%86%8d%e7%94%9f%e4%b8%ad%e3%81%ae%e6%9b%b2%e6%83%85%e5%a0%b1%e3%82%92%e5%8f%96%e5%be%97%e3%83%bb%e8%a1%a8%e7%a4%ba%e3%81%95%e3%81%9b%e3%82%8b","status":"publish","type":"post","link":"https:\/\/apr20.net\/?p=903","title":{"rendered":"[12] \u518d\u751f\u4e2d\u306e\u66f2\u60c5\u5831\u3092\u53d6\u5f97\u30fb\u8868\u793a\u3055\u305b\u308b"},"content":{"rendered":"<p>\u4eca\u56de\u306e\u30c1\u30e5\u30fc\u30c8\u30ea\u30a2\u30eb\u306f\u3001ipod(iphone\uff06ipad\u672a\u691c\u8a3c)\u306e\u30df\u30e5\u30fc\u30b8\u30c3\u30af\u30d7\u30ec\u30a4\u30e4\u30fc\u3067\u518d\u751f\u4e2d\u306e\u66f2\u306e\u60c5\u5831\u3092\u53d6\u308a\u51fa\u3057\u3066\u3001\u8868\u793a\u3055\u305b\u308b\u65b9\u6cd5\u3092\u8aac\u660e\u3057\u307e\u3059\u3002<\/p>\n<p><!--more-->XCode \u3092\u8d77\u52d5\u3057\u3001View Based Application \u3067\u65b0\u898f\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u3092\u4f5c\u6210\u3057\u307e\u3059\u3002<\/p>\n<p>\u3053\u306e\u30c1\u30e5\u30fc\u30c8\u30ea\u30a2\u30eb\u5185\u3067\u306f\u3001\u300cSong\u300d\u3068\u3044\u3046\u540d\u524d\u3067\u4fdd\u5b58\u3057\u307e\u3057\u305f\u3002<\/p>\n<p>\u97f3\u697d\u3001\u52d5\u753b\u306a\u3069\u3068\u3044\u3063\u305f\u30e1\u30c7\u30a3\u30a2\u30a2\u30a4\u30c6\u30e0\u306f\u3001\u30e6\u30fc\u30b6\u304c\u30c7\u30b9\u30af\u30c8\u30c3\u30d7\u306eiTunes\u3068\u540c\u671f\u3057\u305f\u969b\u306b\u30c7\u30d0\u30a4\u30b9\u4e0a\u306b\u30b3\u30d4\u30fc\u3055\u308c\u307e\u3059\u3002 \u30c7\u30d0\u30a4\u30b9\u4e0a\u306e\u30e1\u30c7\u30a3\u30a2\u30a2\u30a4\u30c6\u30e0\u306e\u4e00\u5f0f\u3092iPod\u30e9\u30a4\u30d6\u30e9\u30ea(iPod library)\u3068\u547c\u3073\u307e\u3059\u3002\u3053\u308c\u3089\u306e\u30a2\u30a4\u30c6\u30e0\u3092\u6271\u3046\u305f\u3081\u306b\u3001MediaPlayer\u30d5\u30ec\u30fc\u30e0\u30ef\u30fc\u30af\u3092\u8ffd\u52a0\u3057\u307e\u3059\u3002XCode \u5185\u306e\u30d5\u30ec\u30fc\u30e0\u30ef\u30fc\u30af\u306b\u3001\u300cMediaPlayer.framework\u300d\u3092\u8ffd\u52a0\u3057\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<p><strong>SongViewController.h<\/strong> \u3092\u958b\u304d\u3001\u4ee5\u4e0b\u306e\u30b3\u30fc\u30c9\u3092\u8ffd\u52a0\u3057\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<blockquote>\n<p style=\"margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; color: #d12e1b;\"><span style=\"color: #78492a;\">#import <\/span>&lt;UIKit\/UIKit.h&gt;<\/p>\n<p style=\"margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; color: #d12e1b;\"><span style=\"color: #78492a;\">#import <\/span>&lt;MediaPlayer\/MediaPlayer.h&gt;<\/p>\n<p style=\"margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; min-height: 13.0px;\">\n<p style=\"margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo;\"><span style=\"color: #bb2da2;\">@interface<\/span> SongViewController : UIViewController {<\/p>\n<p style=\"margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; min-height: 13.0px;\">\n<p style=\"margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; color: #4e8187;\"><span style=\"color: #000000;\"><span style=\"white-space: pre;\"> <\/span><\/span><span style=\"color: #bb2da2;\">IBOutlet<\/span><span style=\"color: #000000;\"> <\/span><span style=\"color: #703daa;\">UILabel<\/span><span style=\"color: #000000;\"> *<\/span>songTitleLabel<span style=\"color: #000000;\">;<\/span><\/p>\n<p style=\"margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; color: #4e8187;\"><span style=\"color: #000000;\"><span style=\"white-space: pre;\"> <\/span><\/span><span style=\"color: #bb2da2;\">IBOutlet<\/span><span style=\"color: #000000;\"> <\/span><span style=\"color: #703daa;\">UILabel<\/span><span style=\"color: #000000;\"> *<\/span>songArtistLabel<span style=\"color: #000000;\">;<\/span><\/p>\n<p style=\"margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; color: #4e8187;\"><span style=\"color: #000000;\"><span style=\"white-space: pre;\"> <\/span><\/span><span style=\"color: #bb2da2;\">IBOutlet<\/span><span style=\"color: #000000;\"> <\/span><span style=\"color: #703daa;\">UILabel<\/span><span style=\"color: #000000;\"> *<\/span>songAlbumLabel<span style=\"color: #000000;\">;<\/span><\/p>\n<p style=\"margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; min-height: 13.0px;\"><span style=\"white-space: pre;\"> <\/span><\/p>\n<p style=\"margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo;\">}<\/p>\n<p style=\"margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; min-height: 13.0px;\">\n<p style=\"margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; color: #bb2da2;\">@property<span style=\"color: #000000;\"> (<\/span>nonatomic<span style=\"color: #000000;\">, <\/span>assign<span style=\"color: #000000;\">) <\/span>IBOutlet<span style=\"color: #000000;\"> UILabel *songTitleLabel;<\/span><\/p>\n<p style=\"margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo;\"><span style=\"color: #bb2da2;\">@property<\/span> (<span style=\"color: #bb2da2;\">nonatomic<\/span>, <span style=\"color: #bb2da2;\">assign<\/span>) <span style=\"color: #bb2da2;\">IBOutlet<\/span> UILabel *songArtistLabel;<\/p>\n<p style=\"margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; color: #bb2da2;\">@property<span style=\"color: #000000;\"> (<\/span>nonatomic<span style=\"color: #000000;\">, <\/span>assign<span style=\"color: #000000;\">) <\/span>IBOutlet<span style=\"color: #000000;\"> UILabel *songAlbumLabel;<\/span><\/p>\n<p style=\"margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; min-height: 13.0px;\">\n<p style=\"margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; color: #bb2da2;\">@end<\/p>\n<\/blockquote>\n<p>\u4e0a\u8a18\u306e\u30b3\u30fc\u30c9\u306f\u3001\u7c21\u5358\u304b\u3068\u601d\u3044\u307e\u3059\u304c\u3001\u6700\u521d\u306bMediaPlayer.framework \u304c\u4f7f\u3048\u308b\u3088\u3046\u306b\u30a4\u30f3\u30dd\u30fc\u30c8\u3057\u3066\u3044\u307e\u3059\u3002\u305d\u3057\u3066\u3001\u53d6\u5f97\u3057\u305f\u66f2\u60c5\u5831\u3092 view\u4e0a\u306b\u8868\u793a\u3055\u305b\u308b\u305f\u3081\u306b\u3001\u30e9\u30d9\u30eb\u3092\uff13\u3064\u8a2d\u5b9a\u3057\u3066\u3044\u307e\u3059\u3002\u8868\u793a\u5185\u5bb9\u306f\u3001\u30e9\u30d9\u30eb\u540d\u3092\u898b\u308c\u3070\u5206\u304b\u308a\u307e\u3059\u304c\u3001\u66f2\u306e\u30bf\u30a4\u30c8\u30eb\u3001\u30a2\u30eb\u30d0\u30e0\u540d\u3001\u30a2\u30fc\u30c6\u30a3\u30b9\u30c8\u540d\u3067\u3059\u3002<\/p>\n<p>\u6b21\u306b\u3001<strong>songViewController.m<\/strong> \u3092\u958b\u304d\u3001\u4ee5\u4e0b\u306e\u30b3\u30fc\u30c9\u3092\u8ffd\u52a0\u3057\u307e\u3059\u3002<\/p>\n<blockquote>\n<p style=\"margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; color: #d12e1b;\"><span style=\"color: #78492a;\">#import <\/span>&#8220;SongViewController.h&#8221;<\/p>\n<p style=\"margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; min-height: 13.0px;\">\n<p style=\"margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo;\"><span style=\"color: #bb2da2;\">@implementation<\/span> SongViewController<\/p>\n<p style=\"margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo;\"><span style=\"color: #bb2da2;\">@synthesize<\/span> songArtistLabel, songTitleLabel, songAlbumLabel;<\/p>\n<\/blockquote>\n<p>\u3055\u3089\u306b\u3001viewDidLoad \u30e1\u30bd\u30c3\u30c9\u3092\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u7de8\u96c6\u3057\u307e\u3059\u3002<\/p>\n<blockquote>\n<p style=\"margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; color: #703daa;\">MPMusicPlayerController<span style=\"color: #000000;\"> *player = [<\/span>MPMusicPlayerController<span style=\"color: #000000;\"> <\/span><span style=\"color: #3d1e81;\">iPodMusicPlayer<\/span><span style=\"color: #000000;\">];<\/span><\/p>\n<p style=\"margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; min-height: 13.0px;\"><span style=\"white-space: pre;\"> <\/span><\/p>\n<p style=\"margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo;\"><span style=\"color: #703daa;\">MPMediaItem<\/span> *nowPlayingItem\u00a0= [player <span style=\"color: #3d1e81;\">nowPlayingItem<\/span>];<\/p>\n<p style=\"margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; min-height: 13.0px;\"><span style=\"white-space: pre;\"> <\/span><\/p>\n<p style=\"margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; color: #703daa;\"><span style=\"color: #4e8187;\">songTitleLabel<\/span><span style=\"color: #000000;\">.<\/span>text<span style=\"color: #000000;\"> = [nowPlayingItem <\/span><span style=\"color: #3d1e81;\">valueForProperty<\/span><span style=\"color: #000000;\">:<\/span>MPMediaItemPropertyTitle<span style=\"color: #000000;\">];<\/span><\/p>\n<p style=\"margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; color: #703daa;\"><span style=\"color: #000000;\"> <\/span><span style=\"color: #4e8187;\">songAlbumLabel<\/span><span style=\"color: #000000;\">.<\/span>text<span style=\"color: #000000;\"> = [nowPlayingItem <\/span><span style=\"color: #3d1e81;\">valueForProperty<\/span><span style=\"color: #000000;\">:<\/span>MPMediaItemPropertyAlbumTitle<span style=\"color: #000000;\">];<\/span><\/p>\n<p style=\"margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; color: #703daa;\"><span style=\"color: #4e8187;\">songArtistLabel<\/span><span style=\"color: #000000;\">.<\/span>text<span style=\"color: #000000;\"> = [nowPlayingItem <\/span><span style=\"color: #3d1e81;\">valueForProperty<\/span><span style=\"color: #000000;\">:<\/span>MPMediaItemPropertyArtist<span style=\"color: #000000;\">];<\/span><\/p>\n<\/blockquote>\n<div><span style=\"color: #000000;\">\u73fe\u5728\u518d\u751f\u4e2d\u306e\u30df\u30e5\u30fc\u30b8\u30c3\u30af\u30d7\u30ec\u30a4\u30e4\u30fc\u3092\u8a2d\u5b9a\u3057\u3001\u518d\u751f\u4e2d\u306e\u66f2\u60c5\u5831\u3092\u53d6\u5f97\u3057\u3066\u3044\u307e\u3059\u3002<\/span><\/div>\n<div><span style=\"color: #800000;\">(\u4eca\u56de\u306f\u3001\u53d6\u5f97\u3057\u3066\u3044\u307e\u305b\u3093\u304c\u3001\u6b4c\u8a5e\u3092\u8868\u793a\u3059\u308b\u5834\u5408\u306f\u3001MPMediaItemPropertyLyrics \u3092\u4f7f\u3044\u307e\u3059\u3002MPMediaItem \u306e\u5404\u30d7\u30ed\u30d1\u30c6\u30a3\u306b\u3064\u3044\u3066\u8a73\u3057\u304f\u77e5\u308a\u305f\u3044\u65b9\u306f\u3001\u4e00\u756a\u4e0b\u306b\u53c2\u8003\u30b5\u30a4\u30c8\u3092\u8f09\u305b\u3066\u3044\u308b\u306e\u3067\u3001\u53c2\u7167\u3057\u3066\u304f\u3060\u3055\u3044\u3002)<\/span><\/div>\n<div><span style=\"color: #000000;\"><br \/>\n<\/span><\/div>\n<div><span style=\"color: #000000;\">\u3053\u3053\u3067\u53d6\u5f97\u3057\u305f\u66f2\u60c5\u5831\u3092 view \u4e0a\u306b\u8868\u793a\u3055\u305b\u308b\u305f\u3081\u306b\u3001Interface Builder \u3092\u8d77\u52d5(SongViewController.xib \u3092\u30c0\u30d6\u30eb\u30af\u30ea\u30c3\u30af)\u3057\u3001view \u4e0a\u306b\u30e9\u30d9\u30eb\u3092\u4e09\u3064\u914d\u7f6e\u3057\u307e\u3059\u3002<\/span><\/div>\n<div><span style=\"color: #000000;\">\u305d\u3057\u3066\u3001\u914d\u7f6e\u3057\u305f\u30e9\u30d9\u30eb\u3068XCode\u4e0a\u306b\u5ba3\u8a00\u3057\u305fIBOutlet \u3092\u63a5\u7d9a\u3057\u307e\u3059\u3002<\/span><\/div>\n<div>\u3053\u3053\u307e\u3067\u5b8c\u4e86\u3057\u305f\u3089\u3001\u30d3\u30eb\u30c9\uff06\u5b9f\u884c\u3057\u307e\u3059\u3002\u30c7\u30d0\u30a4\u30b9\u4e0a\u3067\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u3092\u8d77\u52d5\u3059\u308b\u3068\u3001\u30d7\u30ec\u30a4\u30e4\u30fc\u3067\u518d\u751f\u4e2d\u306e\u66f2\u304c\u8868\u793a\u3055\u308c\u307e\u3059\u3002<\/div>\n<div><span style=\"color: #ff0000;\">\u6ce8\u610f\u70b9\u3068\u3057\u3066\u306f\u3001\u30b7\u30df\u30e5\u30ec\u30fc\u30bf\u306b\u306f\u3001\u518d\u751f\u4e2d\u306e\u97f3\u697d\u60c5\u5831\u304c\u306a\u3044\u306e\u3067\u3001\u4f55\u3082\u8868\u793a\u3055\u308c\u307e\u305b\u3093\u3002<\/span><\/div>\n<div><span style=\"color: #ff0000;\">\u307e\u305f\u3001\u518d\u751f\u4e2d\u306e\u66f2\u306b\u6b4c\u8a5e\u304c\u8a2d\u5b9a\u3055\u308c\u3066\u3044\u308b\u306b\u3082\u304b\u304b\u308f\u3089\u305a\u3001\u6b4c\u8a5e\u304c\u8868\u793a\u3055\u308c\u306a\u3044\u306e\u306f\u3001ipod\u304b\u3089\u4e00\u5ea6\u8cb8\u3057\u8868\u793a\u3055\u305b\u308b\u3053\u3068\u3067\u3001\u6b4c\u8a5e\u304c\u53d6\u5f97\u53ef\u80fd\u306b\u306a\u308b\u3068\u601d\u3044\u307e\u3059\u3002\u304c\u3001\u3053\u308c\u3067\u306f\u3001\u3042\u307e\u308a\u5b9f\u7528\u7684\u3067\u306f\u3042\u308a\u307e\u305b\u3093\u306d\u3002\u3002\u3002<span style=\"color: #ff0000;\">AVURLAsset\u306elyrics<\/span><\/span><span style=\"color: #ff0000;\">\u30d7\u30ed\u30d1\u30c6\u30a3\u306a\u3089\u53d6\u5f97\u53ef\u80fd(?)\u3002<\/span><\/div>\n<div><span style=\"color: #ff0000;\"> <\/span><\/div>\n<div><span style=\"color: #ff0000;\"> <\/span><\/div>\n<h4>MPMediaItem\u30af\u30e9\u30b9<\/h4>\n<p>\u53c2\u8003\u30b5\u30a4\u30c8<\/p>\n<p>http:\/\/developer.apple.com\/library\/ios\/#documentation\/MediaPlayer\/Reference\/MPMediaItem_ClassReference\/Reference\/Reference.html<\/p>\n<p>http:\/\/blog.livedoor.jp\/second_flush\/archives\/51141605.html#MPMediaItemPropertyPersistentID<\/p>\n<div><strong><br \/>\n<\/strong><\/div>\n","protected":false},"excerpt":{"rendered":"<p>\u4eca\u56de\u306e\u30c1\u30e5\u30fc\u30c8\u30ea\u30a2\u30eb\u306f\u3001ipod(iphone\uff06ipad\u672a\u691c\u8a3c)\u306e\u30df\u30e5\u30fc\u30b8\u30c3\u30af\u30d7&#8230;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[19],"tags":[88,105,109,110,111,112,113,119],"class_list":["post-903","post","type-post","status-publish","format-standard","hentry","category-old-blog","tag-ipodmusicplayer","tag-mediaplayer-framework","tag-mpmediaitem","tag-mpmediaitempropertyalbumtitle","tag-mpmediaitempropertyartist","tag-mpmediaitempropertytitle","tag-mpmusicplayercontroller","tag-nowplayingitem"],"_links":{"self":[{"href":"https:\/\/apr20.net\/index.php?rest_route=\/wp\/v2\/posts\/903","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/apr20.net\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/apr20.net\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/apr20.net\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/apr20.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=903"}],"version-history":[{"count":0,"href":"https:\/\/apr20.net\/index.php?rest_route=\/wp\/v2\/posts\/903\/revisions"}],"wp:attachment":[{"href":"https:\/\/apr20.net\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=903"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/apr20.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=903"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/apr20.net\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=903"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}