我解決了這個問題。謝謝伊戈爾的想法..
public CustomInformationCell (NSString cellId,int maxLenght,int totalCharLenght)
: base(UITableViewCellStyle.Default, cellId)
{
_maxLength = maxLenght; //max lenght is the longest label length in order to making alignment
SelectionStyle = UITableViewCellSelectionStyle.None;
Accessory = UITableViewCellAccessory.None;
ContentView.BackgroundColor = UIColor.White;
detail = new UILabel();
caption = new UILabel();
caption.TextColor = UIColor.FromRGB (48,110,255);
_scrollView = new UIScrollView {
Frame = new CGRect (0, 0, ContentView.Bounds.Width, ContentView.Bounds.Height),
ContentSize = new CGSize (ContentView.Bounds.Width + totalCharLenght, ContentView.Bounds.Height),
BackgroundColor = UIColor.White,
AutoresizingMask = UIViewAutoresizing.FlexibleWidth
};
_scrollView.AddSubview (caption);
_scrollView.AddSubview (detail);
ContentView.AddSubviews(new UIView[] {_scrollView});
//ContentView.AddSubviews(new UIView[] {caption, detail});
}
感謝您的回覆。最簡單的似乎是3.一個。我試了一下,它添加了垂直滾動,而不是水平..我把它設置爲一個可編輯的虛假..我錯過了什麼? – ertan2002