我正在使用UIFont更改我的应用程序中的默认字体.代码在iOS 10及更低版本上工作正常,但它在iOS 11上返回nil,没有任何改变.我正在使用swift 4
这是我返回nil的代码:
UIFont(name: "AIranianSans", size: 20)
Run Code Online (Sandbox Code Playgroud)
你可以帮帮我吗 ?怎么了 ?
我想打电话,这是我的代码:
if let urlMobile = NSURL(string: "tel://076938483"), UIApplication.shared.canOpenURL(urlMobile as URL) {
if #available(iOS 10.0, *) {
UIApplication.shared.open(urlMobile as URL, options: [:], completionHandler: nil)
}
else {
UIApplication.shared.openURL(urlMobile as URL)
}
}
Run Code Online (Sandbox Code Playgroud)
我正在使用swift 3这样做,但我收到此错误:
-canOpenURL: failed for URL: "tel://09178883828" - error: "The operation couldn’t be completed. (OSStatus error -10814.)"
Run Code Online (Sandbox Code Playgroud)
有没有想过这样做?
我的自定义对话框中有一个时间选择器。结果是:
这是我的代码:
<style name="DialogStyler2" parent="Theme.AppCompat.Light.Dialog.Alert">
<item name="android:background">#FFFFFF</item>
<item name="android:windowSoftInputMode">stateUnspecified|adjustPan</item>
<item name="android:windowNoTitle">true</item>
</style>
final Dialog dialog = new Dialog(SabadKharid_s1.this, R.style.DialogStyler2);
dialog.setContentView(R.layout.dialogtime);
timePicker = (TimePicker) dialog.findViewById(R.id.timePicker);
timePicker.setIs24HourView(true);
WindowManager.LayoutParams lp = new WindowManager.LayoutParams();
lp.copyFrom(dialog.getWindow().getAttributes());
lp.width = WindowManager.LayoutParams.MATCH_PARENT;
lp.height = WindowManager.LayoutParams.WRAP_CONTENT;
dialog.show();
dialog.getWindow().setAttributes(lp);
Run Code Online (Sandbox Code Playgroud)
如您所见,textView标题中的小时和分钟为白色。如何更改其背景颜色?
我正在使用android支持设计小部件BottomNavigationView来制作我的底部导航项。这是工作的结果:

它有2个问题,第一个问题是没有在项目下显示标题,第二个问题是我要填充项目,我不想在导航上有可用空间,我只想让它们填充空间并在项目之间划分空间。
这是我的菜单代码:
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<item
android:id="@+id/action_item1"
android:icon="@drawable/phone"
app:showAsAction="ifRoom"
android:title="??????" />
<item
android:id="@+id/action_item2"
android:icon="@mipmap/ic_history"
app:showAsAction="ifRoom"
android:title="????? ????" />
<item
android:id="@+id/action_item3"
android:icon="@drawable/sabad"
app:showAsAction="ifRoom"
android:title="??? ????" />
<item
android:id="@+id/action_item4"
android:icon="@drawable/market2"
app:showAsAction="ifRoom"
android:title="???????" />
</menu>
Run Code Online (Sandbox Code Playgroud)
这是xml代码:
` <RelativeLayout
android:id="@+id/activity_main"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.truiton.bottomnavigation.MainActivity">
<FrameLayout
android:id="@+id/frame_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_above="@+id/navigation"
android:animateLayoutChanges="true">
</FrameLayout>
<android.support.design.widget.BottomNavigationView
android:id="@+id/navigation"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:background="@color/colorPrimary"
app:itemIconTint="#fff"
app:itemTextColor="#F2F2F4"
app:menu="@menu/bottom_navigation_items"/>
</RelativeLayout>`
Run Code Online (Sandbox Code Playgroud)
我该如何解决这个问题?
android android-support-library android-support-design android-bottomnav
我正在编写一个网络服务,我需要获取一个类别中的所有产品,到目前为止我已经写了这个:
SELECT *,ID, `post_date` , `post_title` , `post_content` , `guid` FROM `wp_posts` as post
INNER JOIN wp_term_relationships rs ON rs.object_id = post.ID
INNER JOIN wp_terms t ON t.term_id = rs.term_taxonomy_id
WHERE `post_type` = 'product'
AND `post_status` = 'publish'
AND rs.term_taxonomy_id =909
Run Code Online (Sandbox Code Playgroud)
代码返回 3 个项目,但问题是,我的网站上有大约 20 种产品属于这个类别,网站上显示了所有这 20 种产品。
这段代码有什么问题?我怎样才能获得一个类别中的所有产品?顺便说一句,如果我可以使用的话,我也正在使用 woocomrce api。