我必须使用UIView水平划分为三个均匀大小的子视图Xcode.我试图使用约束.我得到了以下结果.
在某些屏幕尺寸.在小屏幕电话中,最左侧和最右侧的子视图大小相同.但是,中央子视图在小屏幕中非常小,在大屏幕中非常大.所以请让我知道正确的方法将UIView水平分成三个均匀大小的子视图.提前致谢.
注意:我正在使用 Xcode 8.1
我已经编写了一个代码来显示Toast何时按下耳机媒体按钮.我使用了意图过滤器来完成它.但问题是当我按下媒体按钮时它会发射两次.我的代码是:
MainActivity.java
private MusicIntentReceiver myReceiver;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
myReceiver=new MusicIntentReceiver();
((AudioManager)getSystemService(AUDIO_SERVICE)).registerMediaButtonEventReceiver(new ComponentName(
this,
MusicIntentReceiver.class));
}
@Override
public void onResume(){
IntentFilter filter = new IntentFilter(Intent.ACTION_HEADSET_PLUG);
IntentFilter filter1=new IntentFilter(Intent.ACTION_MEDIA_BUTTON);
filter1.setPriority(100);
registerReceiver(myReceiver, filter);
registerReceiver(myReceiver,filter1);
super.onResume();
}
@Override
public void onPause() {
IntentFilter filter = new IntentFilter(Intent.ACTION_HEADSET_PLUG);
IntentFilter filter1=new IntentFilter(Intent.ACTION_MEDIA_BUTTON);
filter1.setPriority(100);
registerReceiver(myReceiver, filter);
registerReceiver(myReceiver,filter1);
super.onPause();
}
Run Code Online (Sandbox Code Playgroud)
BroadcastReceiver.java
public class MusicIntentReceiver extends BroadcastReceiver {
@Override
public void onReceive(Context context, Intent intent) {
String intentAction=intent.getAction();
Toast.makeText(context, "Action: "+intentAction, Toast.LENGTH_SHORT).show(); …Run Code Online (Sandbox Code Playgroud) 我无法Navigation Bar在我的NavigationController故事板中设置字体.我在这里查了一些问题.他们告诉选项更改可用的字体Attributes Inspector.但是当我在那里检查时,我无法为我选择自定义字体NavigationBar.你可以在下面的屏幕截图中看到.
您可以看到"字体系列"字段已禁用.所以请帮我改变Navigation Bar故事板上的字体.提前致谢.
我正在使用iOS-Charts库在我的项目中制作图表.我试图用dateTime标记绘制一些读数.我将日期对象转换为毫秒,以使其成为折线图接受的双精度值.当我尝试此方法时,空白图表显示标签,没有任何数据点.这在下面的屏幕截图中显示.

当我使用print()函数打印这些数据点时,我得到了以下内容.
ChartDataEntry, x: 1453871669.0, y 24.54
ChartDataEntry, x: 1453869902.0, y 24.84
ChartDataEntry, x: 1453869846.0, y 24.84
Run Code Online (Sandbox Code Playgroud)
我怀疑这是因为x值太高,没有任何意义.如果我有疑问,请提供解决方案以纠正此问题.提前致谢.
我试图在android中Text Message使用发送SmsManager。信息传递良好。当我尝试以其他语言发送消息时,它以的形式发送??????。我不知道出什么问题了。
try {
SmsManager smsManager = SmsManager.getDefault();
String phno = "+919715361062";
String msg = "????????";
smsManager.sendTextMessage(phno, null, msg, null, null);
}catch (Exception e){
e.printStackTrace();
Toast.makeText(MainActivity.this,"Failed",Toast.LENGTH_LONG).show();
}
Run Code Online (Sandbox Code Playgroud) 我用三个创建了一个布局Buttons.我的想法是使用这三个按钮作为日期选择器.这三个按钮-,Today,+.如果我按今天按钮显示今天的日期.当我按-它显示昨天的日期.如果我按+它显示明天的日期.没问题.但它只能工作一次.我的要求是,只要我按-它来显示前一天的日期,即19-Aug-2015,18-Aug-2015,17-Aug-2015等等,我的代码
imgtoday.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
googleMap.clear();
Date date1=new Date(System.currentTimeMillis());
SimpleDateFormat sdf=new SimpleDateFormat("dd-MMM-yyyy");
String date=sdf.format(date1);
drawRoute(date);
imgHistory.setClickable(false);
imgHistory.setBackgroundResource(R.drawable.btn_disabled);
calculateDistance(date);
}
});
previousDay=(Button)findViewById(R.id.button9);
nextDay=(Button)findViewById(R.id.button11);
previousDay.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
googleMap.clear();
Date date1=new Date(System.currentTimeMillis() - (1000 * 60 * 60 * 24));
SimpleDateFormat sdf=new SimpleDateFormat("dd-MMM-yyyy");
String date=sdf.format(date1);
drawRoute(date);
calculateDistance(date);
}
});
nextDay.setOnClickListener(new View.OnClickListener() { …Run Code Online (Sandbox Code Playgroud) 我有一个多维数组.它本身可以有多个数组.有时可能是5或6.现在我想通过使用数组大小从我的多维数组中获取最大的数组.我不知道如何实现这一目标.因此我在这里张贴.提前致谢.
例如:
[["a","b","c"],["d","e","f","g","h","i","j"]]
ios ×4
android ×3
iphone ×2
swift ×2
xcode ×2
arrays ×1
date ×1
fonts ×1
intentfilter ×1
ios-charts ×1
java ×1
smsmanager ×1
swift3 ×1
uiview ×1