情况:
我正在使用Ionic框架制作应用程序.在一个页面中,我需要显示图像.此图像必须水平居中.
ATTEMPT 1:
在文档之后,我将一行划分为三个相等的列,并将图像放在第二行中.
<div class="row">
<div class="col col-33"></div>
<div class="col col-33">
<img src="{{ data.logo }}" alt="">
</div>
<div class="col col-33"></div>
</div>
Run Code Online (Sandbox Code Playgroud)
但不幸的是,图像远未集中.倾向于留在屏幕的左半部分.
ATTEMPT 2:
尝试一些旧的CSS技巧.
<div style="margin: 0 auto;">
<img src=" {{ data.logo }} " alt="" >
</div>
Run Code Online (Sandbox Code Playgroud)
但同样,我没有得到理想的结果.
问题:
我怎样才能在离子框架中居中?
今天早上更新了Xcode,现在离子项目不会部署到设备上.
ionic run ios --device
Run Code Online (Sandbox Code Playgroud)
返回:
** BUILD SUCCEEDED **
xcrun: error: unable to find utility "PackageApplication", not a developer tool or in PATH
Error: Error code 72 for command: xcrun with args: -sdk,iphoneos,PackageApplication,-v
Run Code Online (Sandbox Code Playgroud)
不知道该怎么做才能修复,谷歌搜索返回了很多选项,但没有一个正确.

我想要右边的登录和注册按钮,中心的搜索按钮,我搜索了很多,但没有得到任何解决方案.
还有如何将文本区域对齐到合适的位置.
这是我的HTML代码:
<body ng-app="starter">
<ion-pane style = "background-color:#4992E2;">
<ion-header-bar class="bar bar-subheader" style = " margin-top: -35px; background-color:#F9F9F9;">
<h1 class="title" style = "color:black;">NetHealth Appointment Booking</h1>
</ion-header-bar>
<ion-content >
<div class = "row center">
<div class="col">
<button class="button button-small button-light" >
Login!
</button>
<button class="button button-small button-light">
Register Here!
</button>
</div>
</div>
<div class="item-input-inset">
<h4>Date</h4>
<label class="item-input-wrapper">
<input type="text" placeholder="Text Area">
</label>
</div>
<div class="item-input-inset">
<h4>Suburb</h4>
<label class="item-input-wrapper">
<input type="text" placeholder="Text Area">
</label>
</div>
<div class="item-input-inset">
<h4>Clinic</h4> …Run Code Online (Sandbox Code Playgroud) 我正在尝试运行命令ionic build android --release来构建apk但我收到此错误
总时间:1.767秒错误:cmd:命令失败,退出代码1错误输出:FAILURE:构建失败,异常.
出了什么问题:配置根项目'android'时出现问题.
您尚未接受以下SDK组件的许可协议:[Android SDK Platform 24].在构建项目之前,您需要接受许可协议并使用Android Studio SDK Manager完成缺少的组件的安装.或者,要了解如何将许可协议从一个工作站转移到另一个工作站,请访问 http://d.android.com/r/studio-ui/export-licenses.html
尝试:使用--stacktrace选项运行以获取堆栈跟踪.使用--info或--debug选项运行以获取更多日志输出.拿起_JAVA_OPTIONS:-Xmx512M
看起来最简单的事情,例如为图像使用正确的url路径可能会耗费大量的时间和精力而根本没有成功.
所以,在我的主页上,我尝试使用以下方法之一:
<img src="../assets/img/image.jpg"/>
<img src="/assets/img/image.jpg"/>
<img src="assets/img/image.jpg"/>
<img src="./assets/img/image.jpg"/>
<img src="../../assets/img/image.jpg"/>
Run Code Online (Sandbox Code Playgroud)
所有这些都显示在浏览器上,但不在设备上.
我已经阅读了很多线程,但这是不可靠的,但是没有真正的解决方案.我真的很想知道我在这里做错了什么?任何帮助和真正的解决方案将非常感谢.
我跑步后ionic cordova build android得到这个错误:
FAILURE: Build failed with an exception.
* What went wrong:
Could not resolve all files for configuration ':debugCompileClasspath'.
> Could not find runtime.jar (android.arch.lifecycle:runtime:1.0.0).
Searched in the following locations:
https://jcenter.bintray.com/android/arch/lifecycle/runtime/1.0.0/runtime-1.0.0.jar
Run Code Online (Sandbox Code Playgroud)
这是对的.当我转到此URL时,https://jcenter.bintray.com/android/arch/lifecycle/runtime/1.0.0/runtime-1.0.0.jar我得到404 Not found error一个JSON.
我没有在该URL中看到任何特定于android/cordova的版本,因此我无法从我的cordova安装中说出它.
科尔多瓦版: 7.1.0
离子信息:
cli packages: (C:\Users\%User%\AppData\Roaming\npm\node_modules)
@ionic/cli-utils : 1.19.2
ionic (Ionic CLI) : 3.20.0
global packages:
cordova (Cordova CLI) : not installed // this is strange. I can run cordova in my terminal tho
local …Run Code Online (Sandbox Code Playgroud) 我正在使用Ionic框架构建一个应用程序,到目前为止我已经在浏览器中完成了.因为我现在想使用cordovaOauth插件,我需要使用模拟器.问题是我无法像在浏览器中那样在模拟器中看到任何console.log(),这使得调试变得困难.
有人知道在Ionic/Cordova中我如何在模拟器中使用控制台日志记录?欢迎所有提示!
我正在使用离子 v1.0.0并且不了解并行历史管理的$ionicHistory方式.
特别是在Android设备上,当使用(以前的硬件)后退按钮时,我的Angular应用程序有时表现得很奇怪,我想了解原因.(示例:向后导航打开$ionicGoBack()很久以前关闭的视图)
对我来说,似乎有些ui-router导航创建了新的历史堆栈,而其他人则将历史项目放在根历史中,即使从状态到子状态应该附加到状态记录为IMO的历史记录中.
问题
ui-sref或$state.go(...)将历史项附加到新创建的堆栈?root?很抱歉没有更具体,但应用程序相当复杂,我不知道如何在一个plunkr中隔离问题.也许我错过了一篇好的文档......
我希望创建一个指南针/箭头,就像我们在AroundMe移动应用程序中看到的那样,指向地图上的一个引脚与移动位置相对应,并在我移动手机时更新箭头.
我很难理解如何做到这一点,我找不到任何解释它的指南或教程.
我在网上找到的是一个轴承功能,我围绕它创建了一个指令:
app.directive('arrow', function () {
function bearing(lat1, lng1, lat2, lng2) {
var dLon = (lng2 - lng1);
var y = Math.sin(dLon) * Math.cos(lat2);
var x = Math.cos(lat1) * Math.sin(lat2) - Math.sin(lat1) * Math.cos(lat2) * Math.cos(dLon);
var rad = Math.atan2(y, x);
var brng = toDeg(rad);
return (brng + 360) % 360;
}
function toRad(deg) {
return deg * Math.PI / 180;
}
function toDeg(rad) {
return rad * 180 / Math.PI;
}
return {
restrict: …Run Code Online (Sandbox Code Playgroud) 我正在尝试从早期的firebase版本升级到我的离子项目中的最新版本.我按照本教程进行了升级.在这个页面的第4步中,我被困在最后一个声明中firebase.database().ref();.
错误信息
TypeError: firebase.database is not a function
Run Code Online (Sandbox Code Playgroud)
以下是我的代码.请帮助.
...
// Initialize Firebase
this.config = {
apiKey: "some-api-key",
authDomain: "myapp.firebaseapp.com",
databaseURL: "https://myapp.firebaseio.com",
storageBucket: "project-somenumber.appspot.com",
};
...
this.authWithOAuthPopup = function(type) {
var deferred = $q.defer();
console.log(service.config); // ---> Object {apiKey: "some-api-key", authDomain: "myapp.firebaseapp.com", databaseURL: "https://myapp.firebaseio.com", storageBucket: "project-somenumber.appspot.com"}
firebase.initializeApp(service.config);
console.log(firebase); // ---> Object {SDK_VERSION: "3.0.5", INTERNAL: Object}
service.rootRef = firebase.database().ref(); //new Firebase("https://rsb2.firebaseio.com"); ---> I am getting error on this line "TypeError: firebase.database is not a function" …Run Code Online (Sandbox Code Playgroud) javascript angularjs firebase ionic-framework firebase-realtime-database
ionic-framework ×10
angularjs ×4
cordova ×3
javascript ×3
android ×2
css ×2
angular ×1
console.log ×1
firebase ×1
google-maps ×1
gradle ×1
html ×1
ionic2 ×1
ios ×1
logging ×1
ngcordova ×1
sdk ×1
xcode ×1