小编fab*_*tus的帖子

menu.findItem返回null

我找不到解决方案请帮忙

工具:

public class VentasActivity extends ActionBarActivity
    implements NavigationDrawerFragment.NavigationDrawerCallbacks, android.support.v7.widget.SearchView.OnQueryTextListener
Run Code Online (Sandbox Code Playgroud)

where返回null:

@Override
public boolean onCreateOptionsMenu(Menu menu) {
    if (!mNavigationDrawerFragment.isDrawerOpen()) {
        getMenuInflater().inflate(R.menu.sales, menu);
        restoreActionBar();

       // HERE RETURNS NULL
        searchView = (SearchView) menu.findItem(R.id.action_product_search).getActionView();

        if (searchView != null) {
            final Menu menu_block = menu;
            searchView.setOnQueryTextListener(new SearchView.OnQueryTextListener() {

                @Override
                public boolean onQueryTextSubmit(String query) {
                    // collapse the view ?
                    menu_block.findItem(R.id.action_product_search).collapseActionView();
                    return false;
                }

                @Override
                public boolean onQueryTextChange(String newText) {
                    // search goes here !!
                    // listAdapter.getFilter().filter(query);
                    return false;
                }
            });
            Log.i("sales module", "SearchView OK"); …
Run Code Online (Sandbox Code Playgroud)

android android-layout searchview

14
推荐指数
1
解决办法
9404
查看次数

在显示具有约束的viewcontrollers时,xcode 6接口构建器的性能非常低

我有一个问题,Xcode 6对用户交互的反应非常缓慢,例如编辑代码,滚动区域等.当界面构建器在故事板中显示具有约束的视图控制器时,这尤其会发生(4/14 vcs有约束我刚刚开始另外我使用额外的显示器.

我想知道是否有什么可以改善性能改变xcode选项或其他方式.

我的开发机器是MacBook Pro Retina(Retina,15英寸,2013年末),配备2.3Ghz Intel Core i7和16 GB RAM(1600 MHz DDR3),运行OSX 10.9.5(Mavericks).

xcode interface-builder autolayout xcode6

10
推荐指数
2
解决办法
3573
查看次数

UIButton自定义边框中的Tintcolor

我为圆形自定义边框创建了UIButton的子类:

- (void)drawRect:(CGRect)rect
{
    [[self layer] setCornerRadius:CORNER_RADIUS];
    [[self layer] setMasksToBounds:YES];   
    [[self layer] setBorderWidth:1];
    [[self layer] setBorderColor:self.tintColor.CGColor];
    [self.imageView setTintColor:self.tintColor];
}
Run Code Online (Sandbox Code Playgroud)

问题是当出现一个popover时,自定义边框与tintColor的其他控件的行为不同:

在此输入图像描述

在此输入图像描述

我怎么处理它?

非常感谢

objective-c uibutton tintcolor ios7

5
推荐指数
1
解决办法
819
查看次数

在运行时将图像保存在资产目录中

我必须在后台进程中从后端下载新图像,我需要保存它们以便稍后在应用程序中使用.

另一方面,原始应用程序图像位于资产目录中,当我添加新图像时,必须从资产目录中访问所有图像.

我尝试将图像添加到目录的应用程序但是当我必须加载任何图像时,应用程序不知道区分资产目录中的图像和其他,我认为这不是最好的解决方案

我不知道如何在运行时将图像添加到资产目录,或者我必须尝试其他方式来支持这一点.

任何帮助我都非常感激

非常感谢!

xcode uiimage ios7 asset-catalog

5
推荐指数
1
解决办法
1246
查看次数