我创建了一个离子聊天应用程序,并且在Android上运行正常。但是在ios上,如果您单击输入,页面将向上移动,如下图所示。这仅在iOS上发生。有没有办法针对iOS设备解决此问题?
ionViewDidEnter() {
this.scrollToBottomOnInit();
}
sendMessage() {
if (!this.newMsg) {
return alert('Please enter a message.');
}
this.messageService
// tslint:disable-next-line:max-line-length
.createMessages(id, this.newMsg)
.then(() => {
this.newMsg = '';
this.scrollToBottomOnInit();
});
}
trackByCreated(i, msg) {
return msg.createdAt;
}
scrollToBottomOnInit() {
this.content.scrollToBottom(300);
}
<ion-header>
<ion-toolbar [(ngModel)]="blah" color="primary">
<ion-buttons slot="start">
<ion-back-button></ion-back-button>
</ion-buttons>
<ion-title text-center>{{blah}}</ion-title>
</ion-toolbar>
</ion-header>