Showing: 21 - 30 of 71 Articles

Change the titleLabel of UIButton which title type is Attributed in Storyboard / Xib file

Issue : I have use below code to change Title and set underline of UIButton at run time. [btnTemp setTitle:@”Test” forState:UIControlStateNormal]; I have got below issues: 1. Underline is not showing 2. Title not change 3. Title color is display default black. To overcome this …

Read facebook and phone contacts with permission

Contact typealias CheckContactPermission = (Bool,ABAddressBook?) -> () func checkcontactpermission(pCompletionBlock:CheckContactPermission){ // make sure user hadn’t previously denied access let status = ABAddressBookGetAuthorizationStatus() if status == .Denied || status == .Restricted { // Helper.showAlert(ALERTCONTACTPERMISIONDNIED, pobjView: self.view) // user previously denied, so tell them to fix that in …

Get color of CGPoint from image in UIImageView

Method for fetching color of CGPoint from image in UIImageView :- extension UIImageView { func getColorOfPoint(_ point:CGPoint)->UIColor { var pixel:[CUnsignedChar] = [0,0,0,0] let colorSpace = CGColorSpaceCreateDeviceRGB() let bitmapInfo = CGBitmapInfo(rawValue: CGImageAlphaInfo.premultipliedLast.rawValue) let context = CGContext(data: &pixel, width: 1, height: 1, bitsPerComponent: 8, bytesPerRow: 4, space: colorSpace, …

Parse Your BLE Peripheral Device Characteristic in HEX String

#pragma mark – Peripheral Delegates – (void)peripheral:(CBPeripheral *)peripheral didUpdateValueForCharacteristic:(CBCharacteristic *)characteristic error:(NSError *)error { if (error) NSLog(@”Error reading BLE data: %@”,[error localizedDescription]); else [self parseBLEMessage:characteristic.value]; } – (void)parseBLEMessage:(NSData*)pobjData { NSData *objData = pobjData; NSString *strValue = [getHexString:objdata]; } -(NSString*)getHexString:(NSData*)pdata { NSMutableString *sbuf; NSUInteger capacity = self.length …