Showing: 1 - 6 of 6 Articles

How mobile number to be displayed as (XXX)-(XXX)-XXXX as the user types?

Code given below will help you to format mobile number like (XXX)-(XXX)-XXXX you just need to call this method in your shouldChangeCharactersIn method like this, func textField(_ textField: UITextField, shouldChangeCharactersIn range: NSRange, replacementString string: String) -> Bool { // phonenumber write in specific formate if …

Group Joining Xmpp : Getting all messages every-time after joined group.

Hello, After deep look on group joining method of XMPP, we found one solution is describe here: let  objXmppStream =  XMPPStream() let objGroup = “YourGroupname@YourXMPPHOST” let roomStorage = XMPPRoomMemoryStorage()  let roomJID = XMPPJID.jidWithString(objGroup)  let objXmppChatRoom = XMPPRoom(roomStorage: roomStorage, jid: roomJID, dispatchQueue: dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_LOW, 0))  objXmppChatRoom.activate(XMPPHelper.sharedInstance.objXmppStream)  objXmppChatRoom.fetchConfigurationForm()  let …

UILabel with text of two different colors

Problem: I want to display a string like this in a UILabel: Where the number 5 is red in color and the rest of the string Solution: NSMutableAttributedString *text = [[NSMutableAttributedString alloc] initWithAttributedString: label.attributedText]; [text addAttribute:NSForegroundColorAttributeName value:[UIColor redColor] range:NSMakeRange(10, 1)]; [label setAttributedText: text]; OR NSMutableAttributedString …