我正在制作收件箱模块,我想在标签上显示消息数。数据来自服务器。所以如果我们有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