Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to dynamically resize the buttons & labels in monotouch Xamarin

In xcode I have designed with buttons containing labels I want to resize the buttons and labels depending upon the content.

enter image description here

like image 517
Dorababu Dodda Avatar asked Dec 07 '25 11:12

Dorababu Dodda


1 Answers

You have a few options:

  • you can either adjust the size of your controls yourself, in that case, you would override the ViewDidLoad method in the UIViewController and then set the Frame properties of each one of your views manually.

  • You can use Autolayout to provide rules for how the different elements are displayed on your view. Here is your guide: https://developer.apple.com/library/ios/documentation/userexperience/conceptual/AutolayoutPG/Introduction/Introduction.html

  • You can use a library like MonoTouch.Dialog, which you can use to create the entire UI. MonoTouch Dialog support creating custom views that you can render, so you could use that to have special versions of each view: http://docs.xamarin.com/guides/ios/user_interface/monotouch.dialog/

like image 191
miguel.de.icaza Avatar answered Dec 09 '25 00:12

miguel.de.icaza