我想在我的應用程序中實現NSForm視圖,我是cocoas應用程序中的新成員。可以向我諮詢有關此控制器的信息嗎?如何在可可應用程序中實現NSForm?
回答
你可以在你的應用程序中使用NSForm。
- 在您榫文件中添加NSForm
- 通過編程創建NSForm並附加NSform在你的窗口視圖。
@ 2我這裏有一個例子,使用它可以理解
NSWindow*window = [self window]; // gets current widnow
NSView *theContentView = [window contentView]; // gets view from window
NSRect contentRect = [theContentView frame]; // gets frame from view
NSRect formRect = NSMakeRect(0, 50, 300, 220); // creates new frame
NSForm *theForm;
theForm = [[NSForm alloc] initWithFrame:formRect]; // init with frame fromRect
NSFormCell *theFormCell; // create cell for form
// defines first cell with field First Name
theFormCell = [theForm addEntry:@"First Name:"];
[theFormCell setTag:EContactFieldTag_FirstName];
// defines first cell with field Last Name
theFormCell = [theForm addEntry:@"Last Name:"];
[theFormCell setTag:EContactFieldTag_LastName];
[theForm setCellSize:NSMakeSize(300, 25)]; // defines size for cell
[theForm sizeToCells];
[theForm setKeyCell:theFormCell]; // assign cell to form
[theContentView addSubview:theForm]; // add form to current view
我想這應該幫助您開始。
讓我知道如果您有任何問題。
是感謝其工作fine.Now我想在一個陣列中得到NSFormcell值怎麼可能呢? – mikw 2010-05-21 11:35:58
您可以創建一個數組並循環遍歷它,並讓您創建單元格,如 NSInteger i = 0; for(id * item in array_data){ theFormCell = [theForm addEntry:(NSString *)item]; [theFormCell setStringValue:[[NSString alloc] initWithFormat:@「%d」,i]]; [theFormCell setTag:i]; //爲所有nscell提供標記差異\t i ++; } 這將爲數組中的所有項目生成單元格,並將i值放入其中。 – 2010-05-24 05:59:16
- 1. 如何在可可應用程序中實現多個實例
- 2. 如何在可可應用程序中實現TopBar?
- 3. 如何在可可應用程序中實現Splitview?
- 4. 如何在可可應用程序中實現ScrollView?
- 5. 如何在可可客戶端實現paypal C應用程序
- 6. 在可可應用程序中實現Sprakle.Framework時遇到困難
- 7. 如何在可可應用程序中實現分割pdf功能?
- 8. 如何實現iphone應用程序的可達性
- 9. Facebook應用程序如何實現可拖動浮動按鈕
- 10. 如何在Web應用程序中最好地實現用戶可選變量
- 11. 在Windows和Delphi中實現應用程序可移植性?
- 12. 在UWP應用程序中實現可拆卸面板
- 13. 是否可以在Android應用程序中實現Flex狀態
- 14. 您可以在Java EE Web應用程序中實現Vue.js嗎?
- 15. 有誰可以告訴我如何在我的應用程序中實現c2dm
- 16. 如何在Web應用程序中實現可觀察設計模式?
- 17. 如何在wpf應用程序中實現可編輯的顏色?
- 18. 中央處理器剖析可可應用程序在現場
- 19. 如何在可可應用程序中使用PDFView?
- 20. 增強現實iOS應用程序在小地方 - 可能嗎?
- 21. AuthenticationManager實現如何在SpringBoot應用程序中實例化
- 22. 我可以爲應用程序實現兩個應用程序小部件嗎?
- 23. 如何在可可中重新啓動Finder應用程序?
- 24. 如何在可可應用程序中打包支持文件
- 25. 如何在全屏應用程序中處理可可事件
- 26. 如何在可可應用程序中包含OpenCV?
- 27. 如何在可可應用程序中模仿Finder左樹?
- 28. 如何實現提醒應用程序?
- 29. 如何實現SQLite到應用程序?
- 30. 如何實現應用程序更新?
+1我從來沒有注意到'NSForm'前... – 2010-05-21 14:06:36