Post

Replies

Boosts

Views

Activity

Reply to Access NSLayoutConstraint size class value from IBOutlet
With help from// https://stackoverflow.com/questions/29528661/ ios-detect-current-size-classes-on-viewdidloadI did the following:enum DeviceTraitStatus { ///IPAD and others: Width: Regular, Height: Regular case wR case wC case hR case hC case wRhR ///Any IPHONE Portrait Width: Compact, Height: Regular case wChR ///IPHONE Plus/Max Landscape Width: Regular, Height: Compact case wRhC ///IPHONE landscape Width: Compact, Height: Compact case wChC static var current:DeviceTraitStatus { switch (UIScreen.main.traitCollection.horizontalSizeClass, UIScreen.main.traitCollection.verticalSizeClass){ case (UIUserInterfaceSizeClass.regular, UIUserInterfaceSizeClass.unspecified): return .wR case (UIUserInterfaceSizeClass.compact, UIUserInterfaceSizeClass.unspecified): return .wC case (UIUserInterfaceSizeClass.unspecified, UIUserInterfaceSizeClass.regular): return .hR case (UIUserInterfaceSizeClass.unspecified, UIUserInterfaceSizeClass.compact): return .hC case (UIUserInterfaceSizeClass.regular, UIUserInterfaceSizeClass.regular): return .wRhR case (UIUserInterfaceSizeClass.compact, UIUserInterfaceSizeClass.regular): return .wChR case (UIUserInterfaceSizeClass.regular, UIUserInterfaceSizeClass.compact): return .wRhC case (UIUserInterfaceSizeClass.compact, UIUserInterfaceSizeClass.compact): return .wChC default: return .wChR } } }Then you can use as follows: let dts = DeviceTraitStatus.current if dts == .wChR { // stackViewBottomConstraint.constant = 0 } else { stackViewBottomConstraint.constant = 62 }
Mar ’20
Reply to UITextfield crash in iOS 13 using textField:shouldChangeCharactersInRange:replacementString
Not sure of this, but wonder if that could be the cause: textField.text = updatedString; [self moveCursorToPosition:initialCursorPostition]; //Line 311 in the codeyou change the textFieldthen you moveCursor (relative to textField.text)I wonder if this does not change some var in memory, causing the crash, unless this is due to setSelectedTextRange.Note: could not find func setSelectedTextRange
Mar ’20
Reply to UIDatePicker CountDownTimer Localization Issues
Maybe you'll find a solution and an explanation in this thread:https://stackoverflow.com/questions/35577317/uidatepicker-flips-on-ios9-rtl[Not tested myself] You can force all UIDatePicker classes to be RTL from the AppDelegate.if(SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(@"9.0")) { [[UIView appearanceWhenContainedIn:[UIDatePicker class], nil] setSemanticContentAttribute:UISemanticContentAttributeForceRightToLeft]; }
Mar ’20
Reply to Crazy button behavior...
Does it happens only on one button with a specific image ?Did you try changing the image ?I would try also to test some attributes.- select the image in the assets- open its attributes inspector- try to change render mode to default or template- try to change sxales to single scale
Mar ’20
Reply to display firebase data inside uipickerview
I miss something.in pickerView titleForRow, you use items[row] as data source.But I do not see where you set items in getItems. Maybe in intemInfo (probably itemInfo mispelled), but you do not show the func.something like: items = [] for document in snap!.documents { let data = document.data() let itemCode = data[ITEMS_CODE] as? String ?? "" let itemName = data[ITEMS_NAME] as? String ?? "" items.append(itemName) // Unless done in intemInfo ? let t = intemInfo(itemCode: itemCode, itemName: itemName) self.itemsClass.append(t) //print(document.data()) print("ITEMS_CODE", itemCode as Any) print("ITEMS_NAME", itemName as Any) }
Mar ’20