2017-08-30 101 views
0

如何在附加的圖像中有一個標籤泡泡。我已經爲使用TagView組件的android做了這個,但不知道如何爲Xamarin iOS做到這一點?我可以參考的任何組件?向Xamarin iOS應用程序添加標籤視圖

enter image description here

+0

您可以將ios代碼轉換爲c#並執行以下鏈接https://github.com/rsattar/CLTokenInputView –

回答

0

你將不得不自己寫這個自定義組件。 我建議在XIB/Storyboard中設計這個設計,並在運行時放置em。

非常粗略的想法創造一個這樣子視圖programmitically可能是像你需要做

var myView = new UIView(frame: new CoreGraphics.CGRect(10, 10, 120, 40)); 
    myView.BackgroundColor = UIColor.Blue; 

    myView.Layer.CornerRadius = 20; 

    var mylabel = new UILabel(frame: new CoreGraphics.CGRect(10, 10, 80, 40)); 
    mylabel.Text = "MUMBAI"; 
    myView.Add(mylabel); 

    UIButton button = new UIButton(); 


    button.Frame = new CoreGraphics.CGRect(mylabel.Frame.X + mylabel.Frame.Width, 10f, 40, 25); 
    button.SetTitle("Title", UIControlState.Normal); 
    button.SetBackgroundImage(UIImage.FromBundle("MyImage"),UIControlState.Normal); 
    myView.Add(button); 

    View.Add(myView); 

這裏幀計算,以上只是一些抽樣框,我把。

所以最終你會使這些視圖水平堆疊em,並且當用戶單擊「x」按鈕時,將使用動畫更改框架。

相關問題