本文整理汇总了C#中UISegmentedControl.AddSubview方法的典型用法代码示例。如果您正苦于以下问题:C# UISegmentedControl.AddSubview方法的具体用法?C# UISegmentedControl.AddSubview怎么用?C# UISegmentedControl.AddSubview使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UISegmentedControl
的用法示例。
在下文中一共展示了UISegmentedControl.AddSubview方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CreateSegmentedControl
void CreateSegmentedControl ()
{
// _segmentedControl = new UISegmentedControl (new object[] { "one", "two", "three", "four" });
// _segmentedControl.ControlStyle = UISegmentedControlStyle.Bezeled;
// _segmentedControl.TintColor = UIColor.Black;
// _segmentedControl.SetImage (UIImage.FromFile ("Star.png"), 0);
// _segmentedControl.SelectedSegment = 0;
// _segmentedControl.Frame = new RectangleF (10, 10, View.Frame.Width - 20, 50);
_testLabel = new UILabel { Frame = new RectangleF (10, 200, 100, 50) };
_segmentedControl = new UISegmentedControl (new object[] { UIImage.FromFile ("Star.png"), "two", "three", "four" });
_segmentedControl.ControlStyle = UISegmentedControlStyle.Bezeled;
_segmentedControl.TintColor = UIColor.Black;
_segmentedControl.Frame = new RectangleF (10, 10, View.Frame.Width - 20, 50);
_segmentedControl.ValueChanged += (o, e) =>
{
_text = _segmentedControl.TitleAt (_segmentedControl.SelectedSegment) ?? "title not set";
_testLabel.Text = _text;
};
_segmentedControl.SelectedSegment = 0;
_segmentedControl.AddSubview (_testLabel);
View.AddSubview (_segmentedControl);
}
示例2: Pubnub_MessagingSpeedTest
public Pubnub_MessagingSpeedTest (string channelName, string cipher, bool enableSSL, Pubnub pubnub)
: base (UITableViewStyle.Plain, null)
{
Channel = channelName;
Ssl = enableSSL;
Cipher = cipher;
this.pubnub = pubnub;
string strSsl = "";
if (Ssl) {
strSsl = ", SSL";
}
string strCip = "";
if (!String.IsNullOrWhiteSpace (Cipher)) {
strCip = ", Cipher";
}
string head = String.Format ("Ch: {0} {1} {2}", Channel, strSsl, strCip);
bool bIphone = true;
string hardwareVer = DeviceHardware.Version.ToString ().ToLower ();
if (hardwareVer.IndexOf ("ipad") >= 0) {
bIphone = false;
}
InitArrays();
perfHeader = new PerformanceHeader();
secOutput = new Section(perfHeader.View);
sdHeader = new SdHeader(speedTestNames, speedTestSorted);
sdHeader.View.Tag = 101;
graphHeader = new GraphHeader();
graphHeader.View.Tag = 102;
UISegmentedControl segmentedControl = new UISegmentedControl();
segmentedControl.HorizontalAlignment = UIControlContentHorizontalAlignment.Center;
segmentedControl.Frame = new RectangleF(10, 20, UIScreen.MainScreen.Bounds.Width - 20, 40);
segmentedControl.InsertSegment("Graph", 0, false);
segmentedControl.InsertSegment("SD", 1, false);
segmentedControl.AutoresizingMask = UIViewAutoresizing.FlexibleWidth;
segmentedControl.AddSubview(graphHeader.View);
segmentedControl.ValueChanged += (sender, e) => {
var selectedSegmentId = (sender as UISegmentedControl).SelectedSegment;
if (segmentedControl.SelectedSegment == 0)
{
if(segmentedControl.ViewWithTag(101) != null)
{
segmentedControl.ViewWithTag(101).RemoveFromSuperview();
}
graphHeader.View.AutoresizingMask = UIViewAutoresizing.FlexibleHeight | UIViewAutoresizing.FlexibleWidth;
segmentedControl.AddSubview(graphHeader.View);
}
else if (segmentedControl.SelectedSegment == 1)
{
if(segmentedControl.ViewWithTag(102) != null)
{
segmentedControl.ViewWithTag(102).RemoveFromSuperview();
}
sdHeader.View.AutoresizingMask = UIViewAutoresizing.FlexibleHeight | UIViewAutoresizing.FlexibleWidth;
segmentedControl.AddSubview(sdHeader.View);
}
};
segmentedControl.SelectedSegment = 0;
segmentedControl.ControlStyle = UISegmentedControlStyle.Plain;
secOutput.Add(segmentedControl);
Section sectionSegmentedControl = new Section();
//sectionSegmentedControl.Add(segmentedControl);
root = new RootElement (head) {
new Section("PubNub speed test"),
secOutput,
//sectionSegmentedControl
};
Root = root;
this.Root.UnevenRows = true;
dvc = new DialogViewController (UITableViewStyle.Plain, root, true);
dvc.NavigationItem.RightBarButtonItem = new UIBarButtonItem(UIBarButtonSystemItem.Cancel, delegate {
pubnub.EndPendingRequests ();
runSpeedtest = false;
speedTestThread.Join(1000);
AppDelegate.navigation.PopToRootViewController(true);
});
dvc.TableView.ScrollEnabled = true;
dvc.TableView.SeparatorColor = UIColor.Clear;
dvc.TableView.SeparatorStyle = UITableViewCellSeparatorStyle.None;
dvc.TableView.BackgroundView = null;
dvc.TableView.BackgroundColor = UIColor.White;
AppDelegate.navigation.PushViewController (dvc, true);
//.........这里部分代码省略.........