2014-04-07 2 views
0

Xamarin Studio에서 C#을 사용하여 iOS 용 코드를 작성하고 있습니다. dialogViewController에서 여러 섹션이있는 rootElement를 만듭니다. 어떻게 섹션의 오른쪽, 캡션 및 요소를 정렬 할 수 있습니까? 나는이 같은 rootElement을 만드는거야 :DialogViewController에서 rootElement의 오른쪽 섹션 정렬 방법

RootElement CreateRootElement() 
{  
    return new RootElement ("RootElement") 
    { 
    new Section ("Caption1") { 
    (createFirstElement()) 
    }, 
    new Section ("Caption2")) { 
    (createSecondElement()) 
    } 
    }; 
} 

List<Element> createFirstElement() 
{ 
List<Element> myList; 
//fill this list 
return myList; 
} 

답변

0

할 수 있습니다 다음과 같은 방법으로 '(UIView의 헤더) 공공 제'섹션 초기화를 사용하여 오른쪽 정렬 섹션 캡션을 만듭니다

private UILabel LabelForSection(string title) { 
    RectangleF frame = new RectangleF(0, 0, UIScreen.MainScreen.Bounds.Width, 22); 
    UILabel label = new UILabel(frame); 
    label.TextAlignment = UITextAlignment.Right; 
    label.Text = "Caption1"; 
    return label; 
} 

그리고 다음과 같이 귀하의 섹션을 초기화 :

: 당신이 말할 때 무엇을 의미하는지

new Section(LabelForSection("Caption1")) 

당신의 예를 줄 수

섹션의 오른쪽 요소를 어떻게 정렬합니까?