我正在製作收件箱模塊,我想在標籤上顯示消息數。數據來自服務器。所以如果我們有30條消息,標籤將顯示30條消息。如何做到這一點?做推送通知的概念會用在這裏還是別的什麼東西?如何在ios中的收件箱中顯示消息數
2
A
回答
0
創建通過編程方式或使用IBOutlet
的一個UILablel
並設置frame
其中u要申請,最後定像
#import <QuartzCore/QuartzCore.h>
UILabel *label=[[UILabel alloc]initWithFrame:CGRectMake(50, 50, 30, 30)]; //change the frame size as you need
label.layer.borderColor = [UIColor whiteColor].CGColor;
label.layer.borderWidth = 2.0;
label.layer.cornerRadius = label.bounds.size.height/2;
label.TextAlignment=NSTextAlignmentCenter;
label.layer.masksToBounds = YES;
label.text=[NSString stringWithFormat:@"%d",yourarrayname.count]; // here add your message array name
label.textColor=[UIColor whiteColor];
label.backgroundColor=[UIColor redColor];
[self.view addSubview:label];
斯威夫特
let label: UILabel = UILabel(frame: CGRectMake(50, 50, 30, 30))//change the frame size as you need
label.layer.borderColor = UIColor.whiteColor().CGColor
label.layer.borderWidth = 2.0
label.layer.cornerRadius = label.bounds.size.height/2
label.TextAlignment = .Center
label.layer.masksToBounds = true
label.text = "\(yourarrayname.count)" // here add your message array name
label.textColor = UIColor.whiteColor()
label.backgroundColor = UIColor.redColor()
self.view!.addSubview(label)
輸出
+0
如果你需要任何幫助,我改變了我的答案 – 2014-10-31 05:40:45
+0
會讓你知道後檢查它.. :)符合我的標準:) – 2014-10-31 12:59:51
相關問題
- 1. 正在顯示消息gmail帳戶的收件箱
- 2. Android中的收件箱消息
- 3. 消息不顯示在iOS中的UITextView?
- 4. 如何在android中訪問消息收件箱
- 5. 如何將消息添加到AVD的收件箱中
- 6. 如何發送消息在朋友消息文件夾/收件箱在Facebook?
- 7. Rails僅顯示收件箱中用戶的最後一條私人消息
- 8. Facebook風格的消息收件箱
- 9. 如何在Gmail收件箱中顯示姓名 - PHP
- 10. 如何在發送新消息時刷新收件箱(如Gmail)
- 11. 在我的收件箱中閱讀短信消息
- 12. 如何顯示當前用戶的收件箱中的SharePoint 2007
- 13. 如何在secondActivity中顯示Toast消息?
- 14. 如何在logcat中顯示長消息
- 15. 如何在Maven中顯示消息
- 16. 如何在查看消息旁邊創建收件箱
- 17. Java - 將消息添加到收件箱
- 18. 發送回覆收件箱消息?
- 19. 如何在使用MFMessageComposeViewController控件時不在消息收件箱中插入消息內容
- 20. 如何在Visual C#中的消息框中顯示整數?
- 21. 是否可以在Android中操作消息查詢(收件箱)?
- 22. 如何接收微信在ios中迭代的消息?
- 23. 檢索設備的所有收件箱中的消息android
- 24. 在ExtJs中顯示消息
- 25. 如何在POV顯示中顯示不同的消息?
- 26. 如何在數據表中顯示空的消息,如果angularjs
- 27. CLLocationManager授權消息不在ios iOS 8.0.1中顯示
- 28. 將消息保存到Android中的收件箱?
- 29. 如何檢索/顯示最後收到的SMS從收件箱中的Android
- 30. 顯示/解碼接收到的聊天消息XMPP框架ios
r你在應用程序內部使用這種方法 – 2014-10-31 05:13:21
意味着?應用程序內的方法? – 2014-10-31 05:16:33