copyå±æ§ã®ä½¿ãã©ãã
ããããã£ã«è¨å®ããå¤ã«å¯å¤ãªãµãã¯ã©ã¹ãããå ´å(NSStringãNSArray)ã«ã¯copyã«ããã¨ããã
retainã ã¨äºæãã¬ã¨ããã§å¤æ´ãããããããããã
Objective-Cã§ã®UITableViewã®ä½ãæ¹
iPhoneã¨ããã°TableViewã§ãããã
ããã¦ãTableViewãä½ããã¨ããåºæ¥ãªãã¦Objective-Cã«ããiPhoneã¢ããªéçºãæ«æãã¦Titaniumãããã¨ã«ããã¨ãã話ãæã
èãã®ã§ä½ãæ¹ã®ç´¹ä»ã§ãã
ï¼ã¾ãã·ã³ãã«ãªTableViewãã¼ã¹ã®ã¢ããªã±ã¼ã·ã§ã³ã§ããã°Titaniumã§ãã£ãæ¹ãç°¡åã«ä½ãã¦ããããªãã¨ã¯æãã¾ãï¼
- ã¾ãã¯ããããããããã«ViewBaseã§ä½ãã¾ãã
- ã»ã¨ãã©ã®å ´åã¯NavigationBaseã§ä½ããã¨ã«ãªãã¨æãã®ã§ãããä»åã¯ã·ã³ãã«ãªæ§é ã§ããããããããããã«ViewBaseã§
- ã¨ããããTableViewãè²¼ãä»ãã¾ãã
- TableViewãæ¥ç¶ãã¾ã
- DataSourceã¨Delegateãè¨å®ãã¾ãã
- DataSourceã¯ãã¼ã¿ã«å¯¾ããè¦æ±ãå¦çãã¦ãããã¯ã©ã¹ã§ãDelegateã¯TableViewã«å¯¾ãã¦ã®ã¤ãã³ããå¦çãã¦ãããã¯ã©ã¹ãæå®ãããã®ã§ãããã§ã¯åãViewControllerã«ãã¦ãã¾ãã
- ããã¾ã§ããã°å¾ã¯å°ãã³ã¼ãæ¸ãã ãã§ãã
- ã¾ãã¯.hã«ãã¼ã¿ã¨ãã¦ä½¿ãé åãdelegateãæå®ãã¾ãã
@interface TableViewSampleViewController : UIViewController <UITableViewDelegate, UITableViewDataSource>{ UITableView *sampleTable; NSArray *tableData; }
- .mã«ãã¼ã¿ã¨ãã¦ä½¿ãé åã«ãã¼ã¿ãå ¥ãã¾ãã
- (void)dealloc { [sampleTable release]; [tableData release]; [super dealloc]; } : - (void)viewDidLoad { [super viewDidLoad]; tableData = [[NSArray alloc]initWithObjects:@"æ°å®¿", @"代ã æ¨", @"å宿", @"æ¸è°·", nil]; }
- UITableViewDataSourceã®delegateã§requiredã«ãªã£ã¦ããã¡ã½ãããå®è£ ãã¾ãã
// æå®ããindexã®cellãä½æããã -(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { // ã»ã«ãåå©ç¨ããããã®ã³ã¼ã static NSString *cellID = @"SampleView"; UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:cellID]; if (cell == nil) { cell = [[[UITableViewCell alloc]initWithFrame:CGRectZero reuseIdentifier:cellID]autorelease]; } // ãã é åã®å¤ãè¨å®ãã¦ããã ã cell.textLabel.text = [tableData objectAtIndex:indexPath.row]; return cell; } // ãã¼ã¿ã®ç·ä»¶æ°ãè¿ãã¡ã½ãã -(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { return [tableData count]; }
- ã¨ããããããã ãæå®ããã°ãããªæãã§TableViewã使ããã¨ãåºæ¥ã¾ãã
- ãã¨ã¯cellãã¯ãªãã¯ããã®ã¤ãã³ãã追å ããããã°ä¸è¨ã®ã¡ã½ãããå®è£ ããã°åºæ¥ã¾ãã
(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
ç°¡åã§ããï¼
ã½ã¼ã¹ã¯gistã«ããã¦ããã¾ããã
https://gist.github.com/1966940
XCodeã®ä½¿ãæ¹ã
æ®æ®µã¯Vimã使ã£ã¦ãã¦ãObjective-Cæ¸ãã¨ãã ãXCode使ã£ã¦ããã®ã§æä½ã«æ
£ããéå¹çã«ãªã£ã¦ããã®ã§ã
使ãæ¹ããã£ã¦ãããå¿ããã®ã§èªåã®ç¨ã«ã¡ã¢ãããã¼ã¸ãä½ããã¨ã«ããã
VPSã«ã¤ããããã¨æã£ããã©ãgithubã®wikiã§ããããããªãï¼ã¨æã£ãã®ã§ãgithubã§æ¸ãã¦ãããã¨ã«ã
https://github.com/koba04/xcode-operation
markdownè¨æ³ã«ããã¼ãã«ã¯ãªãã®ãï¼ï¼
æ¹éå¤æ´
åå¼·ããæ¥æ¯ã«æ¸ãã®ã§ã¯ãªããç« ãªã©ã¾ã¨ã¾ã£ãåä½ã§æ¸ãã¦ãããã¨ã«ããã
iPhoneã¢ããªéçºã®åå¼·(11æ¥ç®)
ãã£ãã¨ããChpter5ã6ã®LESSON18ã20
å°ãã注ææ¸ãã«ãæ¸ããã¦ããéããªã®ãã家ã®åç·ã«ã¤ãªãã ãã·ã³ã ã¨locationManager:didUpdateToLocation:fromLocationã¡ã½ãããå¼ã°ããç¾å¨ä½ç½®ã®åå¾ãåºæ¥ãªãã£ãããªã®ã§ããã®åä½æ¤è¨¼ã¯åºæ¥ã¦ããªãã
- ä½ç½®æ å ±ã使ãã¨ãã¯MapKitã¨CoreLocationã®frameworkãFrameworksã®ãã£ã¬ã¯ããªã«å ¥ãã¦ããã
- ä½ç½®æ å ±ã®åå¾ã¯CLLocationManagerã¯ã©ã¹ã使ã£ã¦ãdelegateã§åå¾ããã
- MKReverseGeoCoderã¯åå¾ã«å¤±æãããã¨ãå¤ããããã
- Xcodeã§è¤æ°ã®ã½ã¼ã¹ã«åãæ¿ãã¯Ctrl+1ãCtrl+2ãCtrl+3ã¨ãã§ããæ¹æ³ä»¥å¤ã«ä½ããªãã®ã ããããã
- self.view.frameã¯è¦ªãã¥ã¼ãåºæºã¨ããä½ç½®ã«ãªã£ã¦self.view.boundsã¯èªåèªèº«ãåºæº(?)ã«ãªã£ã¦ããã®ã§å¸¸ã«(0,0)ãåºæºç¹ã«ãªãã
iPhoneã¢ããªéçºã®åå¼·(10æ¥ç®)+ãã¾ã
ãã£ãã¨ããChapter05ã®LESSON17ã
ããã¯ãã Mapã表示ãããã ãã
æ¶ãã¦ããç¹ã¨ãã¦ã¯ãBuild PhaseããMapKitã¨CoreLocationãã¬ã¼ã ãã¯ã¼ã¯ã追å ãã¦ãããã¨ãããã
ãã£ãã¨ããã05-03åæ°é»åã®ä¾ãããã07-03ãããæ¼ç®åã«ããããããã£ã¸ã®ã¢ã¯ã»ã¹ãã¾ã§ã
ã¡ã¢ãªç®¡çæ¹æ³
- ããã§ã¯ç¬¬ï¼çãã追å ãããæ°ããã¡ã¢ãªç®¡çæ¹æ³ã®ARCã«ã¤ãã¦ã®èª¬æãªã©ãã¡ã¢ãªç®¡çã«ã¤ãã¦ããã¢ã¯ã»ãµã¡ã½ããã®å®ç¾©æ¹æ³ã«ã¤ãã¦æ¸ããã¦ããã
- ARCæ¹å¼ã§ã¯@autoreleasepoolã®ãããã¯ãå®ç¾©ããã¨ãã¨ã§retainãreleaseãautoreleaseãªã©ãããã°ã©ããæèããªãã¦ããã
- éã«ä½¿ã£ã¦ã¯ãããªãã
@autoreleasepool { : : }
- ãããã¯ãæããã°èªåçã«éæ¾ããã¦æ¥½ããã ãã©ã循ç°åç §ã¯__weakã§å¼±åç §ã«ããå¿ è¦ããã£ãããallocãcopyãmutableCopyãnewãinitã®ã¡ã½ãããã¡ããªã«ä¸è´ããã¡ã½ããåãé常ã®ã¡ã½ããã§ä½¿ã£ã¦ãããªãã¨ãã注æç¹ãããã
- deallocã§ã®releaseãå¿ è¦ãªãã
- ã¾ãããããä½ãããä»éçºç°å¢ãSnow Leopardãªã®ã§ä½¿ããªãããã§ããããããéçºã¯ARCæ¹å¼ã使ã£ãã¡ã¢ãªç®¡çæ¹æ³ãæ¨å¥¨ããã¦ããã
- ãã®è¾ºãã®åç §ãã¨ãã¯Cã®ãã¤ã³ã¿ã®ç¥èãå¿ è¦ã ã£ãããå¾ããå®æçã«è¦ç´ãç« ã«ãªãããã
- ã¬ã¼ãã¸ã³ã¬ã¯ã·ã§ã³ã®é ç®ã¯ãã¾ãã¡ããã¨èªãã§ããªããiOSã§ã¯ä½¿ããªãã®ã§ã
- æåã®ã¡ã¢ãªç®¡çæ¹æ³ããARCæ¹å¼ã使ãã³ã¼ãã¸ã®å¤æ´ã¯XCodeã®ã¡ãã¥ã¼ããåºæ¥ãããã(æªç¢ºèª)
ããããã£
- ã¤ã³ã¿ã¼ãã§ã¤ã¹ãã¡ã¤ã«ã§@propertyã§å®£è¨ãã¦ãå®è£ ãã¡ã¤ã«ã§@synthesizeã§å®£è¨ãããå®è£ ãæ¸ãå ´åã¯@dynamicã§å®£è¨ãããåç §ã«ã¦ã³ã¿å¢ããå ´åã¯retainã§ãªãã¸ã§ã¯ã以å¤ãã«ã¦ã³ã¿ãå¢ãããªãå ´åã¯ãassignã§ãARCæ¹å¼ã§ãæå®ããå¿ è¦ãããã
- ãããæ¼ç®åã使ããã®ã¯ã¯ã©ã¹ã§å宣è¨ãã¦ããå ´åã ã(idã¯ãã¡)
- å¼æ°ãæããªãã¡ã½ããã¯ãããæ¼ç®åã§å¼ã¹ããã©ã使ãã®ã¯ããããã£ã§å®£è¨ããã¦ãããã®ã ãã«ããã¹ãã
- ããããã£ã¯ã³ã¼ãã£ã³ã°ã楽ã«ãã¦ãããç´ æ´ãããä»çµã¿ã ã¨æã£ãã
ã¨ã¦ã大åãªãã¨ãæ¸ããã¦ããã¨ããã§ãã£ããèªãã ã¤ããã ãã©ãã¾ã ãã£ããã¨ã¯ç解ã§ãã¦ããªããããARCã§ããã«ãã¦ãåç
§ã«ã¦ã³ã¿ã«ä»çµã¿ã¯ç¥ã£ã¦ããå¿
è¦ããããªãã¨æã£ãã
ãã¾ã
- ããã°ã©ãã®æ°å¦ãæ¯æãã«èªãã§ãããã©ãããã¯ã¨ã¦ãããæ¬ãé«ä¸ã§æ°å¦ããéããèªåã«ã¨ã£ã¦ã¯ã¨ã¦ããããããã¦ããã¢ã«ã¬ã³ã®æ³åã¨ãã«ã«ãã¼å³ã¨ããã¨ã¦ããããããã説æããã¦ãã¦ãã«ã«ãã¼å³ã使ã£ã¦ã°ã«ã¼ãåãã¦è«çå¼ãåç´åããä»çµã¿ã®èª¬æãªã©ãããã¼ã¨æã£ã¦æ¥½ããèªããã
- ã¾ã çå½å¤ã®ã¨ãããèªãã ã ããªã®ã§ãç¶ãã楽ãã¿ã
iPhoneã¢ããªéçºã®åå¼·(9æ¥ç®)
ãã£ãã¨ããChapter4ã®LESSON15ãLESSON16ã
ããã§ã¯åçã®è¡¨ç¤ºã¨ã»ãã¢ã«å å·¥ãã¦ä¿åãããã¨ããã£ãã
åçãã»ãã¢ã«ããã¨ããã®ã³ã¼ãã¯å°ãããããããã©ããã以å¤ã®ã¨ããã¯ã¨ã¦ãã·ã³ãã«ã§åãããããã£ãã
ã»ãã¢ã«ããã¨ããã¯ãã®æ¬ã®æ§è³ªãããã¦ããã¨ï¼ã¨æã£ããã©ãã¾ãããããããå¤åãè¦ããããã«å
¥ããã®ããªã¨ãæã£ãã
- UIImageWriteToSavedPhotosAlbumé¢æ°ãåæçã«åçãä¿åãã¦ãããã«selectoræå®ãã¦å®äºæã®å¦çãæ¸ãããã«ãªã£ã¦ããã®ã¯ãããããã³ã°ãã¦ã¦ã¼ã¶ã¼ã«å¾ ãããªãããã®å·¥å¤«ã«ãªã£ã¦ãã¦ãªãã»ã©ãªãã¨æã£ãã
ãã£ãã¨ããã04-05ã¯ã©ã¹ãªãã¸ã§ã¯ããããã05-02æåã«ã¦ã³ã¿ç®¡çæ¹å¼ãã¾ã§ã
ã¯ã©ã¹ã¡ã½ãã
- ã¯ã©ã¹ã¡ã½ããã®å®ç¾©ã¯é ã«(+)ã
- NSObjectã«ããclassã¡ã½ããã§ã¯ã©ã¹ãªãã¸ã§ã¯ããåå¾ãããã¨ãåºæ¥ãã(åã¯Class)
- ã¯ã©ã¹åã¯ãã¼ãã³ã¼ãã£ã³ã°ããããªãç¶æ³ã®æã¯ä¸ã¿ãããªæãã§ã¯ã©ã¹ã¡ã½ãããå¼ã³åºããã¨ãå¯è½ã
[[obj class] classMethod]
- ã¯ã©ã¹å¤æ°ã¯ãªãã®ã§staticãã¤ããå¤æ°ã§å®ç¾©ããããã®å ´åç¶æ¿ã¯ãããªãã®ã§ãµãã¯ã©ã¹ã§ä½¿ãããå ´åã¯ãã¢ã¯ã»ãµãç¨æããã
- ã¯ã©ã¹ãªãã¸ã§ã¯ãã®åæåã¯initializeã¡ã½ããã§å¼ã³åºããããåæã«å¼ã³åºãããã®ã§æ示çã«æ¸ãã¡ããã¡ãã¾ããè¤æ°åå¼ã°ãã¦ããããããªããªãããã«ã³ã¼ããæ¸ãã¦ããå¿ è¦ããããï¼åæåãã©ã°ãç¨æããã¨ãï¼
- initializeã¯idåã§è¿ãã¹ãã
ã¡ã¢ãªç®¡ç
- LionãiOS5以éã§ã¯æ°ãã追å ãããARCã¨ããæ¹å¼ã使ç¨ãããã¨ãæ¨å¥¨ããã¦ããããã®å ´åã§ããªãã¡ã³ã¬ã³ã¹ã«ã¦ã³ã¿æ¹å¼ã®ä»çµã¿ã¯ç¥ã£ã¦ãããã»ããããã
- allocã§ç¢ºä¿ãã¦ãretailã§åç §ã«ã¦ã³ã¿ãã¤ã³ã¯ãªã¡ã³ããreleaseã§ãã¯ãªã¡ã³ãã
- ãã®ãªãã¸ã§ã¯ããæã£ã¦ããå¤æ°ã®éæ¾ã¯ãdeallocã§è¡ãã
- NSAutoreleasePoolã«ä»»ããæ¹æ³ãããã
- ã³ã³ããã¨ã³ã¹ã³ã³ã¹ãã©ã¯ã¿ã¯autoreleaseããç¶æ ã§ä½æãããã
ãã®è¾ºãã®ãã¸ãã¯ä»¥å¤ã®é¨åã«æ°ã使ãå¿
è¦ãããã¨ããã®ã¯ããã£ã±ãé¢åãªã¨ããã§ã¯ãããªã¨æã£ãã