這是Xcode裡HellowWorld的原始碼
- (void)drawRect:(NSRect)dirtyRect {
NSString* hello=@"Hello, World!!";
NSPoint point=NSMakePoint(15, 75);
NSMutableDictionary* font_attributes=[NSMutableDictionary new];
NSFont* font=[NSFont fontWithName:@"Arial" size:42];
[font_attributes setObject:font forKey:NSFontAttributeName];
[hello drawAtPoint:point withAttributes:font_attributes];
[font_attributes release];
}
想請問兩個問題是:
1. font_attributes宣告時的[NSMutableDictionary new]中的new是什麼意思?
2. [font_attributes release] 刪掉這一行程式也可執行
這一行只是為了要釋放記憶體嗎
謝謝..
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 114.39.168.61
推
05/06 15:47, , 1F
05/06 15:47, 1F
→
05/06 18:33, , 2F
05/06 18:33, 2F
→
05/06 18:35, , 3F
05/06 18:35, 3F
討論串 (同標題文章)