uiswitch

UISwitch inside custom UITableViewCell not available

ぐ巨炮叔叔 提交于 2019-12-18 10:30:22
问题 I have a UISwitch inside a custom UITableViewCell (the subclass of which I call RootLabeledSwitchTableCell ). The cell contains a UILabel and UISwitch next to each other. I have a @property called keychainSwitch that points to the switch inside this custom cell: @interface RootLabeledSwitchTableCell : UITableViewCell { IBOutlet UILabel *textLabel; IBOutlet UISwitch *labeledSwitch; } @property (nonatomic, retain) IBOutlet UILabel *textLabel; @property (nonatomic, retain) IBOutlet UISwitch

Add switch in UITableView cell in Swift

怎甘沉沦 提交于 2019-12-18 04:43:14
问题 How can I embed a UISwitch programmatically in a tableView cell in Swift? I'm doing it like that let shareLocationSwitch = UISwitch() cell.accessoryView = shareLocationSwitch 回答1: Here is way you can embed a UISwitch on a UITableView cell. func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { var cell = tableView.dequeueReusableCell(withIdentifier: "yourcellIdentifire", for: indexPath) as! YourCellClass //here is programatically switch make to the

Custom On/Off Image iOS 7.0 UI Switch

不羁的心 提交于 2019-12-18 04:29:13
问题 In iOS 7 switches don't allow custom on/off images by default. While I can still set them in the Interface Builder it doesn't show up. https://developer.apple.com/library/ios/documentation/userexperience/conceptual/TransitionGuide/TransitionGuide.pdf The transition guide merely notes that it isn't on by default anymore. Presumably there is a way to change that so I do use the images I have. 回答1: Can you use a UIButton instead, using the "selected" state to mean "on"? 回答2: Apple never let this

iPhone UIButton with UISwitch functionality

天涯浪子 提交于 2019-12-17 10:22:33
问题 Is there either a way to implement UISwitch with custom graphics for the switch-states? Or as an alternative the other way round, an UIButton with UISwitch functionality? 回答1: UIButton already supports a "switch" functionality. Just set a different image in Interface Builder for the "Selected State Configuration", and use the selected property of UIButton to toggle its state. 回答2: set the image to show on selected state: [button setImage:[UIImage imageNamed:@"btn_graphics"] forState

UISwitch not deallocating

陌路散爱 提交于 2019-12-14 04:19:59
问题 This is a repost of my question before but because of too many edit's and I've simplified my examples, I thought it would be more clear if I create a new question instead of re-edit the questions multiple times. PROBLEM: UISwitch object somehow doesn't deallocate even when nothing has been done with it. PROJECT: There are only two view controllers. VC1 and VC2. VC1 has one button to present VC2. VC2 contains one button to dismiss itself and a property of a custom UISwitch , UILabel and a

iphone what to use as there are no “radio buttons”

泄露秘密 提交于 2019-12-14 03:16:31
问题 For the iPhone, I havent been able to find anything like a radio button that triggers the other buttons in a group. So what would everyone suggest using? UISwitch I guess and do something to trigger the others in the group when an other is selected? If I had several UISwitch objects how would I trigger the others to be the opposite of what I switched? 回答1: I also used a custom UISegmentedControl. Something like this: NSMutableArray* buttons; - (void)touchDownAction:(UIButton*)button { [self

iPhone: UISwitch text in non-English language is I/O instead of ON/OFF in some languages

北城余情 提交于 2019-12-13 06:44:04
问题 UISwitch text shows ON/OFF in English. When I switch language to Japanese, UISwitch shows localized version for ON/OFF text. But, when I switch language to German, UISwitch shows I/O symbols instead of German-localized ON/OFF text. Why is not the behavior consistent across all non-English languages? Is this a bug? Please let me know if you have any info on this. Thanks. 回答1: I think the problem is that in some languages these words are just to big to fit into the button. This has also to do

Initialization of UISwitch causes unrecognized selector exception in iOS 6

喜夏-厌秋 提交于 2019-12-13 03:43:38
问题 I have a UISwitch in my view and everything works fine for iOS 7 both on my device and the simulator, but when I run my application in the iOS 6 simulator I get a weird exception. The exception breakpoint fires at this particular line of code: self.mySwitch = [[UISwitch alloc] init]; with the following output: -[__NSCFString count]: unrecognized selector sent to instance Is this somehow a bug in the simulator? I have no idea how to fix this and at the moment I don’t have an iOS 6 device at

Adding values to NSArray from dynamically created UISwitch elements

心不动则不痛 提交于 2019-12-13 00:49:14
问题 I have an app that needs part of the interface to be generated dynamically. Via an API response, I get a JSON representation, containing an ID and label, for each item I need to create. Over a couple of steps, I convert the JSON to arrays and save the values to a plist. Next step is to build the interface from the saved values. This all works as planned. I can dynamically generate the interface elements and they actually show up on the screen where they are supposed to! The problem I am

Custom switch in Android with text in track

僤鯓⒐⒋嵵緔 提交于 2019-12-12 11:31:20
问题 I have a custom switch. I want the text (on/off) to be in the track and not in the thumb. I was thinking of setting a selector with text in drawable and setting it as track of the switch. But I cannot set text in a shape. Any ideas how I can do this? I also want to add some padding to the track, I dont want the thumb to touch the track. This is kind of how I want it to look: This is the shape of my track: <shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape=