这是我目前的布局:
<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/scrollview"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="#F5F5DC"
>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<RadioGroup
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
>
<RadioButton android:id="@+id/radio_red"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:drawableLeft="@drawable/flag_dk"
android:textColor="#000000"
android:layout_gravity="center_horizontal"
android:drawablePadding="10dip"
android:text="Danish" />
<RadioButton android:id="@+id/radio_blue"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:drawableLeft="@drawable/flag_en"
android:layout_gravity="center_horizontal"
android:layout_marginTop="5dip"
android:drawablePadding="10dip"
android:textColor="#000000"
android:text="English" />
</RadioGroup>
</LinearLayout>
</ScrollView>
Run Code Online (Sandbox Code Playgroud)
我明白了:

我想在radiobutton和旗帜之间有一些空间(边距)(它是可绘制的).它甚至可能吗?
如果我从我的应用程序拨打电话,我无法检测到呼叫结束(状态CallStateDisconnected).但如果我的应用程序处于活动状态时接到电话,我可以检测到该状态.当我的应用程序启动呼叫时,我还会收到状态CTCallStateDialing两次或三次.它曾经在iOS5下工作,这个问题出现在iOS6上.
我的app del code;
self.callCenter = [[CTCallCenter alloc] init];
self.callCenter.callEventHandler = ^(CTCall* call) {
// anounce that we've had a state change in our call center
NSDictionary *dict = [NSDictionary dictionaryWithObject:call.callState forKey:@"callState"]; //BREAKPOINT HERE
[[NSNotificationCenter defaultCenter] postNotificationName:@"CTCallStateDidChange" object:self userInfo:dict];
};
Run Code Online (Sandbox Code Playgroud)
奇怪的是它一切正常,如果我在callEventHandler块中放置断点并在调用完成后恢复执行,那么我正确地获得CallStateDisconnected.
然后我在视图控制器中订阅通知,并在收到它时执行此代码:
- (void)ctCallStateDidChange1:(NSNotification *)notification
{
NSString *call = [[notification userInfo] objectForKey:@"callState"];
if ([call isEqualToString:CTCallStateDisconnected])
{
NSLog(@"Call has been disconnected");
}
else if([call isEqualToString:CTCallStateDialing])
{
NSLog(@"Call start");
}
else if ([call isEqualToString:CTCallStateConnected])
{
NSLog(@"Call has just been connected");
}
else …Run Code Online (Sandbox Code Playgroud) 我刚刚更新到XCode 5.我的应用程序中的按钮在IB和iOS 6设备上看起来很好,但在iOS 7设备上它们看起来像这样(它们应该覆盖整个黑色空间):

我有非视网膜/视网膜的图像.
我不知道该怎么做,因为我没有更改代码或IB中的任何内容.
编辑:
现在我发现,如果我将按钮的类型从自定义更改为系统并设置其背景而不是其图像,我会得到正确的大小,但我会得到一些奇怪的阴影.
EDIT2:
现在我将按钮的色调颜色设置为"清晰颜色",一切似乎都正常(阴影消失).仍然不确定iOS 7中与此相关的变化.
到目前为止,我已经为Android开发了.在那里,您可以为几乎每个UI元素设置layoutMargin和padding(当您在xml文件中描述UI时).
如何在iOS中的UIViews代码中完成(如果有一个通用命令)?
TNX
我尝试使用此代码获取运营商名称(使用CoreTelephony):
CTTelephonyNetworkInfo *netinfo = [[CTTelephonyNetworkInfo alloc] init];
CTCarrier *carrier = [netinfo subscriberCellularProvider];
NSLog(@"Carrier Name: %@", [carrier carrierName]);
Run Code Online (Sandbox Code Playgroud)
它返回"Carrier".如果我去iPhone设置我的运营商名称是正确的.我手机上的iOS是v4.2.1.
我究竟做错了什么?
我发现了如何在地图注释周围绘制一个cricle.我是这样做的:
MKCircle *circle = [MKCircle circleWithCenterCoordinate:theCoordinate radius:15000];
[myMap addOverlay:circle];
-(MKOverlayView *)mapView:(MKMapView *)mapView viewForOverlay:(id)overlay
{
MKCircleView *circleView = [[MKCircleView alloc] initWithOverlay:overlay];
circleView.fillColor =[UIColor redColor];
return circleView;
}
Run Code Online (Sandbox Code Playgroud)
它工作正常,但我想绘制一个圆形,其填充颜色不是这样的实心:

我想在代码中实现与在xml中相同的东西(此imageview在内部相对布局中):
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:src="@drawable/logo"/>
Run Code Online (Sandbox Code Playgroud)
我知道如何设置布局宽度和高度,但不知道如何设置layout_alignParentLeft ="true".
是否可以在代码中执行此操作?
我的微调器被定义为这样,它似乎是android:divider ="#66BC31"没有效果,我仍然得到白色分隔符:
<Spinner
android:id="@+id/spinner"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginTop="15dip"
android:layout_marginBottom="15dip"
android:layout_marginLeft="10dip"
android:layout_marginRight="10dip"
android:textColor="#ffffff"
android:divider="#66BC31"
android:background="@drawable/spina" />
Run Code Online (Sandbox Code Playgroud)
这是我的代码,我更改我的微调器字体并选择下拉资源:
ArrayAdapter<String> adapter = new ArrayAdapter<String>(Roaming.this,
R.layout.roaming_spinner, data) {
public View getView(int position, View convertView, ViewGroup parent) {
View v = super.getView(position, convertView, parent);
Typeface externalFont = Typeface.createFromAsset(getAssets(),
"fonts/HelveticaNeueLTCom-Lt.ttf");
((TextView) v).setTypeface(externalFont);
return v;
}
public View getDropDownView(int position, View convertView,
ViewGroup parent) { // we need this so we can use custom
// font for spinner (open)
View v = super.getDropDownView(position, convertView, parent);
Typeface externalFont …Run Code Online (Sandbox Code Playgroud) 我希望旋转器下拉菜单在旋转器本身正下方打开.例如:

如何设置微调器下拉的位置?
我知道如何创建静音推送通知(播放静音的声音文件).我还想发送一个不振动手机的推送通知.
当按照以下建议设置静音声音文件时,手机在锁定或应用程序未激活时仍会振动.
我的有效载荷仍然振动:
{
aps = {
alert = {
"loc-key" = "SOME_KEY";
};
badge = 1;
sound = "silence.caf";
};
}
Run Code Online (Sandbox Code Playgroud)
这可能吗?