uiswitch

Reducing the size of UISwitch in Xamarin Forms does not work

旧时模样 提交于 2021-02-11 18:22:51
问题 In Xamarin Forms, I created a custom renderer for Switch . On iOS, I updated the scale transform to make it smaller than its default size: Control.Transform = CGAffineTransform.MakeScale((float)0.75, (float)0.75); While this successfully resizes the Switch , it doesn't resize its bounding box. How can I resize it as well? Here the background color of the Switch is set to red in XAML. It looks like the original bounds are still being maintained even though the thumb is smaller. 回答1: You can

UISwitch doesn't work on Google Maps SDK for iOS?

南笙酒味 提交于 2021-02-07 19:49:43
问题 I'm trying to create a UISwitch laid on mapView_ of Google Maps for my iOS app, but it seems not to work. In details, I first followed instruction from google, created mapView_, then made it my viewcontroller's view: self.view = mapView_; Then, I created an UISwitch programmatically and added it as a subview: mySwitch = [[UISwitch alloc] initWithFrame:CGRectMake(50, 360, 0, 0)]; [mySwitch setBackgroundColor:[UIColor clearColor]]; [mySwitch addTarget:self action:@selector(changeSwitch:)

xamarin.forms add switch in toolbar

不问归期 提交于 2021-02-07 10:19:05
问题 Is it possible to add a switch on the toolbar? <ContentPage.ToolbarItems> <ToolbarItem> <Switch x:Name="Switch1" IsToggled="True" Margin="5,0,0,0"/> </ToolbarItem> </ContentPage.ToolbarItems> Does anybody have any ideas? Thanks! 回答1: <ContentPage xmlns="http://xamarin.com/schemas/2014/forms" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" xmlns:local="clr-namespace:TitleViewSample" x:Class="TitleViewSample.MainPage"> <NavigationPage.TitleView> <Switch x:Name="Switch1" IsToggled="True"

xamarin.forms add switch in toolbar

北战南征 提交于 2021-02-07 10:17:28
问题 Is it possible to add a switch on the toolbar? <ContentPage.ToolbarItems> <ToolbarItem> <Switch x:Name="Switch1" IsToggled="True" Margin="5,0,0,0"/> </ToolbarItem> </ContentPage.ToolbarItems> Does anybody have any ideas? Thanks! 回答1: <ContentPage xmlns="http://xamarin.com/schemas/2014/forms" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" xmlns:local="clr-namespace:TitleViewSample" x:Class="TitleViewSample.MainPage"> <NavigationPage.TitleView> <Switch x:Name="Switch1" IsToggled="True"

Get Switch State from specific cell

痞子三分冷 提交于 2020-12-06 16:55:49
问题 I am working on a iOS app that has two ViewControllers . The first is a TableView which creates a row for each index in a array. Each cell of this TableView shows the content in the array corresponding to the index and has a switch. The second ViewController has an image and a label and they are supposed to change depending the switch state. So, how can I get the switch state from a specific cell? import UIKit class ViewController: UIViewController, UITableViewDataSource, UITableViewDelegate

Get Switch State from specific cell

霸气de小男生 提交于 2020-12-06 16:55:11
问题 I am working on a iOS app that has two ViewControllers . The first is a TableView which creates a row for each index in a array. Each cell of this TableView shows the content in the array corresponding to the index and has a switch. The second ViewController has an image and a label and they are supposed to change depending the switch state. So, how can I get the switch state from a specific cell? import UIKit class ViewController: UIViewController, UITableViewDataSource, UITableViewDelegate

Combine UISwitch and UITableViewCell for VoiceOver interaction

丶灬走出姿态 提交于 2020-06-27 06:47:54
问题 In Calendar, when you create a new event, if you tap on the All Day cell with VoiceOver enabled, Siri says "All Day switch button on/off, double tap to change setting". And indeed double tapping will toggle the switch. Also, it's not possible to tap on just the toggle switch itself - you have to interact with the cell itself to toggle the switch, the switch itself is not an accessible element. In my app I have the exact same setup with a label and a switch. But when I tap the cell with

KVO not working with UISwitch

大城市里の小女人 提交于 2020-04-10 14:11:40
问题 For the life of me I can't get KVO working with UISwitch. I have a custom UITableViewCell with a UISwitch added through Interface Builder. I created an IBOutlet for the UISwitch and linked it to theSwitch variable. - (id)initWithCoder:(NSCoder *)coder { self = [super initWithCoder:coder]; if (self) { [theSwitch addObserver:self forKeyPath:@"on" options:NSKeyValueObservingOptionNew context:NULL]; } return self; } - (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:

KVO not working with UISwitch

冷暖自知 提交于 2020-04-10 14:09:37
问题 For the life of me I can't get KVO working with UISwitch. I have a custom UITableViewCell with a UISwitch added through Interface Builder. I created an IBOutlet for the UISwitch and linked it to theSwitch variable. - (id)initWithCoder:(NSCoder *)coder { self = [super initWithCoder:coder]; if (self) { [theSwitch addObserver:self forKeyPath:@"on" options:NSKeyValueObservingOptionNew context:NULL]; } return self; } - (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change: