Как установить infowindow маркера карты Google макс. высота?

Swift 2.0:

Использовать AlertController.

Пример для листа действий:

  let mediaActionSheet: UIAlertController = UIAlertController(title: "Media Action Sheet", message: "Choose an option!", preferredStyle: .ActionSheet)

  //Create and add the Cancel action
  let cancelAction: UIAlertAction = UIAlertAction(title: "Cancel", style: .Cancel) { action -> Void in

   //Just dismiss the action sheet

  }
  mediaActionSheet.addAction(cancelAction)
  //Create and add first option action
  let takePictureAction: UIAlertAction = UIAlertAction(title: "Take Picture", style: .Default) { action -> Void in

   //Code for launching the camera goes here

  }

  mediaActionSheet.addAction(takePictureAction)

  //Create and add a second option action
  let choosePictureAction: UIAlertAction = UIAlertAction(title: "Choose From Gallery", style: .Default) { action -> Void in

   //Code for picking from gallery goes here

  }

  mediaActionSheet.addAction(choosePictureAction)

  //Present the AlertController
  self.presentViewController(mediaActionSheet, animated: true, completion: nil)

Пример для предупреждений:

1)

let simpleAlert = UIAlertController(title: "Simple Alert", message: "It is just awesome", preferredStyle: UIAlertControllerStyle.Alert);

  //show it
  showViewController(simpleAlert, sender: self);

2) Уведомление с TextField в нем.

  let inputTextFieldAlert:UIAlertController = UIAlertController(title: " Input TextField Alert ", message: " Enter on the below TextField ", preferredStyle: UIAlertControllerStyle.Alert);

  //default input textField (no configuration...)
  inputTextFieldAlert.addTextFieldWithConfigurationHandler(nil);

  //no event handler (just close dialog box)
  inputTextFieldAlert.addAction(UIAlertAction(title: "No", style: UIAlertActionStyle.Cancel, handler: nil));

  //event handler with closure
  inputTextFieldAlert.addAction(UIAlertAction(title: "Yes", style: UIAlertActionStyle.Default, handler: {(action:UIAlertAction) in

   let fields = inputTextFieldAlert.textFields!;
   print("Output: "+fields[0].text!);
  }));

  presentViewController(inputTextFieldAlert, animated: true, completion: nil);

3)

var alert = UIAlertController(title: "TextField Alert", message: "Enter on the below TextField", preferredStyle: UIAlertControllerStyle.Alert);

  //configured input textField
  var field:UITextField?;

  alert.addTextFieldWithConfigurationHandler({(input:UITextField)in
   input.placeholder="Empty Dtaa ;-)";
   input.clearButtonMode=UITextFieldViewMode.WhileEditing;

   field=input;
  });

  //YES Handler
  func yesHandler(actionTarget: UIAlertAction){

   print(field!.text!);
  }
  //event handler with predefined function
  alert.addAction(UIAlertAction(title: "Yes", style: UIAlertActionStyle.Default, handler: yesHandler));

  presentViewController(alert, animated: true, completion: nil);
9
задан egaga 28 May 2009 в 07:42
поделиться

2 ответа

Эта проблема также может быть результатом применения унаследованных стилей к содержимому информационного окна после того, как оно было прикреплено к карте.

Например: размер шрифта будет рассчитываться на основе шрифта по умолчанию. Когда информационное окно прикреплено, шрифт изменится на основе унаследованного CSS и, если он больше, будет выходить за нижнюю часть информационного окна.

Если вы не хотите удалять унаследованный стиль (и в большинстве случаев вы этого не сделаете), вам необходимо явно отменить унаследованный стиль в содержимом информационного окна.

Вы можете найти отличное описание этой проблемы и ее решение по адресу:

Исправление проблемы 'унаследованного CSS'

7
ответ дан 4 December 2019 в 10:05
поделиться

Если InfoWindow содержит изображение, оно может быть переполнено, потому что размер InfoWindow устанавливается перед загрузкой изображения. В этом случае вам нужно указать размер изображения или предварительно загрузить его.

В противном случае я бы просто поместил содержимое в div с полосой прокрутки:

div.infowindow {
    max-height:250px;
    overflow-y:auto;
}
4
ответ дан 4 December 2019 в 10:05
поделиться
Другие вопросы по тегам:

Похожие вопросы: