小编Gee*_*eek的帖子

改变UITabBar的高度

UITabBarController用作root视图,app支持iOS 6及更高版本.项目类层次结构如下.

UITabBarController
  - tab1
    - UINavigationController
      - UIViewController
      - UIViewController
      .
      .
  - tab2
    - UINavigationController
      - UIViewController
      - UIViewController
      .
      .
      .
  - tab3
    - UIViewController
  - tab4
    - UIViewController
Run Code Online (Sandbox Code Playgroud)

我使用下面的代码来改变上面层次结构UITabBar中的一个UIViewControllers(在里面UINavigationController)的高度.

CGRect tabbarFrame = self.tabBarController.tabBar.frame;
tabbarFrame.size.height += 60;
self.tabBarController.tabBar.frame = tabbarFrame;
Run Code Online (Sandbox Code Playgroud)

但它没有改变高度.UITabBar以默认高度显示.虽然记录其值打印更改值,如下所示.

<UITabBar: 0xb528f60; frame = (0 431; 320 109); autoresize = W+TM; layer = <CALayer: 0xb529080>>
Run Code Online (Sandbox Code Playgroud)

我怎样才能改变UITabBar高度来达到这样的目的:?

在此输入图像描述

height objective-c uitabbarcontroller uitabbar ios

61
推荐指数
14
解决办法
7万
查看次数

"Google Plus登录"集成时出现"内部错误"

我正在尝试按照以下链接提供的说明在我的应用程序中集成G​​oogle plus登录:https: //developers.google.com/+/quickstart/android#install-sdk

我完全遵循所有指示.当我在android-sdk中提供的真实设备上运行示例应用程序并单击signin按钮时,它会显示Toast消息An internal error occurred

我究竟做错了什么?

android google-plus

42
推荐指数
4
解决办法
3万
查看次数

单元测试私有方法 - 目标C.

我用GHUnit.我想单独测试私有方法,不知道如何测试它们.我找到了很多关于为什么不测试私有方法的答案.但没有找到如何测试它们.

我不想讨论是否应该测试私有,但是会关注如何测试它.

谁能给我一个如何测试私有方法的例子?

unit-testing objective-c gh-unit ios ios6

38
推荐指数
2
解决办法
1万
查看次数

什么是zend框架2中的'may_terminate'?

我是Zend的初学者.我may_terminate在模块路由配置中看到过.我不明白它的用途.根据ZF2官方文档,

the option “may_terminate” hints to the router that no other 
segments will follow it.
Run Code Online (Sandbox Code Playgroud)

我仍然没有得到的含义no other segments will follow it.这是什么it?有人可以用小例解释吗?

php zend-route zend-router zend-framework2

24
推荐指数
1
解决办法
5601
查看次数

java.io.IOException:未找到身份验证质询

我是android的新手,这是我在android上的第一个项目.我在"认证"问题上苦苦挣扎了一天多.我尝试了几个选项,但没有一个可行.

基本上,我想调用REST API并获得响应.我确信API中没有问题,因为我在另一个iOS应用程序中使用相同的API.

我传递授权标题但仍然显示身份验证未找到消息.我发现与stackoverflow相关的问题很少,但是其中一些没有用,有些对我没有意义.

我得到状态代码401.我知道这意味着要么没有传递身份验证,要么传递,那么它们就错了.在这里,我确信我传递的是正确的.

以下是我的代码:

try {
    url = new URL(baseUrl);
}
catch (MalformedURLException me) {
     Log.e(TAG, "URL could not be parsed. URL : " + baseUrl + ". Line : " + getLineNumber(), me);
     me.printStackTrace();
}

try {
    urlConnection = (HttpURLConnection) url.openConnection();
    urlConnection.setRequestMethod(method); 
    urlConnection.setConnectTimeout(TIMEOUT * 1000);
    urlConnection.setChunkedStreamingMode(0);

    // Set HTTP headers                 
    String authString = "username:password";
    String base64Auth = Base64.encodeToString(authString.getBytes(), Base64.DEFAULT);
    urlConnection.setRequestProperty("Authorization", "Basic " + base64Auth);
    urlConnection.setRequestProperty("Accept", "application/json");
    urlConnection.setRequestProperty("Content-type", "application/json");

    if (method.equals("POST") || method.equals("PUT")) {
        // Set …
Run Code Online (Sandbox Code Playgroud)

java authentication android httpurlconnection ioexception

23
推荐指数
2
解决办法
3万
查看次数

ImageView.getWidth()返回0

我得到imageView的宽度0.下面是代码.

xml文件:

<ImageView
        android:id="@+id/img"
        android:layout_width="200dp"
        android:layout_height="200dp" />
Run Code Online (Sandbox Code Playgroud)

活动:

@Override
protected void onResume() {
    super.onResume();
    ImageView img = (ImageView) findViewById(R.id.img);
    Log.d(TAG, "width : " + img.getWidth());
}
Run Code Online (Sandbox Code Playgroud)

我不想使用下面的代码,因为我需要将这些代码放在很多地方.

ViewTreeObserver vto = img.getViewTreeObserver();
    vto.addOnPreDrawListener(new ViewTreeObserver.OnPreDrawListener() {
        public boolean onPreDraw() {
            ImageView img = (ImageView) findViewById(R.id.img);
                    Log.d(TAG, "width : " + img.getWidth());
            return true;
        }
    });
Run Code Online (Sandbox Code Playgroud)

我的解决方法: 我实际上后来不需要在活动中添加此代码.我将它添加到非活动类而不是ImageView的宽度我使用了Bitmap图像的宽度,现在没有这个问题.

java android android-imageview android-activity

19
推荐指数
2
解决办法
3万
查看次数

WakefulBroadcastReceiver无法解析为某种类型

我的项目显示错误消息WakefulBroadcastReceiver cannot be resolved to a type.我抬头看看我能想到的所有可能的原因.我已android-support-librarygoogle play services的路径.即使我的mapView工作(如果我在代码下面注释),这意味着google play service正确地添加到项目中.

public class GcmBroadcastReceiver extends WakefulBroadcastReceiver {

    @Override
    public void onReceive(Context context, Intent intent) {
        // Explicitly specify that GcmIntentService will handle the intent.
        ComponentName comp = new ComponentName(context.getPackageName(),
            GcmIntentService.class.getName());
        // Start the service, keeping the device awake while it is launching.
        startWakefulService(context, (intent.setComponent(comp)));
        setResultCode(Activity.RESULT_OK);
    }
}
Run Code Online (Sandbox Code Playgroud)

知道为什么会出错吗?

java android

18
推荐指数
3
解决办法
2万
查看次数

如何在Google地图上使用相同位置处理多个标记?

我在应用中使用谷歌地图,很可能多个标记附加到每个标记代表一个人的同一位置.在这种情况下,用户将不知道该特定标记后面还有其他标记/人.

我环顾四周来处理这种情况,关于SO的一个问题表明我可以显示一个标记并将所有人与该单个标记相关联.当用户点击该标记时,我应该显示与该标记关联的所有用户的列表.这是一个很好的解决方法,但我想避免显示主要隐藏谷歌地图的视图.

有没有人在类似情况下使用过任何解决方法?

android google-maps objective-c google-maps-markers ios

18
推荐指数
1
解决办法
2万
查看次数

使用oauth和twitter4j进行Android Twitter集成

我想在一个Android应用程序中集成twitter,并找到了许多教程.实施了其中2个.但是在实现之后,当运行应用程序时,我才知道他们使用旧版本的twitter4J库.

虽然有很多其他的教程可用,但没有一个是最新的.只有2-3个月大.我需要一个使用最新twitter4J库版本的教程或示例,即twitter4j-core-3.0.3.

我的主要目的是允许用户tweets在他/她的帐户上发布.但同样,如果用户没有登录,我首先需要请求凭据.此外,如果用户点击logout按钮,那么我需要一些方法来记录用户.

twitter android twitter4j twitter-oauth android-twitter

17
推荐指数
2
解决办法
3万
查看次数

"除非您更新Google Play服务,否则此应用无法运行"提醒

我在模拟器上运行项目时收到"更新Google Play服务"警报.如果我点击,OK那么它背后还会有一个警报.我一直点击OK,已经出现了大量的警报,我最终放弃了.

消息如下:

在此输入图像描述

我已经尝试在SDK管理器中更新所有内容.也在Eclipse中尝试过,帮助 - >检查更新.

android android-emulator google-play-services

17
推荐指数
4
解决办法
4万
查看次数