当前位置:  编程技术>移动开发
本页文章导读:
    ▪UIPopoverController例证        UIPopoverController例子        UIPopoverController做了个例子,在做时碰到一个郁闷的问题。例子代码检查没有问题,也不报错,可popover就是不显示,纠结哈。参考了些博文也没找到答案,最后无.........
    ▪ andengine 纹理质量有关问题        andengine 纹理质量问题 问题:   The problem: poor texture quality in android app written with Andengine(wraps opengl), especially on gradients which appear as steps in few colours. Problem occurs on real and virtual device Settings: default .........
    ▪ eeeeeer 二       eeeeeer 2 eeeeeer 22 ......

[1]UIPopoverController例证
    来源: 互联网  发布时间: 2014-02-18
UIPopoverController例子

       UIPopoverController做了个例子,在做时碰到一个郁闷的问题。例子代码检查没有问题,也不报错,可popover就是不显示,纠结哈。参考了些博文也没找到答案,最后无意中发现popover显示的位置我设的是向下UIPopoverArrowDirectionDown导致没能显示出来。

以下为实例:

//
//  SearchPopoverViewController.h
//  Ipad004
//  搜索框-显示popover
//  Created by Dwen on 12-11-2.
//  Copyright (c) 2012年 __MyCompanyName__. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface SearchPopoverViewController : UITableViewController
@end

 

#import "SearchPopoverViewController.h"

@interface SearchPopoverViewController ()

@end

@implementation SearchPopoverViewController

- (id)initWithStyle:(UITableViewStyle)style
{
    self = [super initWithStyle:style];
    if (self) {
        // Custom initialization
    }
    return self;
}

- (void)viewDidLoad
{
    [super viewDidLoad];
}

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
	return YES;
}

#pragma mark - Table view data source

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
    return 1;
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    return 4;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    static NSString *CellIdentifier = @"Cell";
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
    if (cell == nil) {
        cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:CellIdentifier];
    }
    cell.textLabel.text = @"商品";
    cell.detailTextLabel.text = @"约800条";
    return cell;
}

#pragma mark - Table view delegate

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
 
}

@end
 
SearchPopoverViewController *spVC = [[SearchPopoverViewController alloc] initWithNibName:@"SearchPopoverViewController" bundle:nil];

//    SearchPopoverViewController *spVC = [[SearchPopoverViewController alloc] initWithStyle:UITableViewStylePlain];
    spVC.contentSizeForViewInPopover = CGSizeMake(200, 300);
    popover = [[UIPopoverController alloc] initWithContentViewController:spVC];
    [popover presentPopoverFromRect:[self.searchBar bounds] inView:self.searchBar permittedArrowDirections:UIPopoverArrowDirectionAny animated:YES];

 


 

 

 


    
[2] andengine 纹理质量有关问题
    来源: 互联网  发布时间: 2014-02-18
andengine 纹理质量问题

问题:

 

The problem: poor texture quality in android app written with Andengine(wraps opengl), especially on gradients which appear as steps in few colours. Problem occurs on real and virtual device

Settings: default texture, fullscreen, native resolution, android 2.2. I have tried to enforce PixelFromat with:

public void onAttachedToWindow() {
    super.onAttachedToWindow();
    Window window = getWindow();
    window.setFormat(PixelFormat.RGBA_8888);
}

Haven't made any difference.

Commenting line: GLHelper.disableDither(pGL); helped a little with textures, but made particles look bad, so a guess it is not the source of problem.

Example loading code:

public static void loadResources(StreamgameActivity game) {
    magnetTexture = new BitmapTextureAtlas(512, 512, TextureOptions.BILINEAR);
    magnetTextureRegion = BitmapTextureAtlasTextureRegionFactory
       .createFromAsset(magnetTexture, game,"bateria128CMatte_none.png", 0, 0);
    game.getEngine().getTextureManager().loadTexture(magnetTexture);
}

解决方法:
方法一:

Andengine seems to use be default 16bit rendering mode. To change that I have done:

this.mRenderSurfaceView = new RenderSurfaceView(this);
mRenderSurfaceView.setEGLConfigChooser(8,8,8,8,0,0);//!!
mRenderSurfaceView.setRenderer(mEngine);
mRenderSurfaceView.getHolder().setFormat(PixelFormat.RGBA_8888);//!!

in onSetContentView method.

方法二:

if someone is experiencing poor texture quality and banding for GLES2 here is the solution: just overridepreDraw() of your Sprite and enable dithering like this:

Sprite electricityOff = new Sprite(0, 0, mElectricityOffTextureRegion, getVertexBufferObjectManager()) {
    @Override
    protected void preDraw(GLState pGLState, Camera pCamera) {
        super.preDraw(pGLState, pCamera);
        pGLState.enableDither();
    }
};

Key element is pGLState.enableDither();. You will not need anything else but in case you want to ensure 32bit rendering for the surface and activity you can add:

@Override
protected void onSetContentView() {
    mRenderSurfaceView = new RenderSurfaceView(this);
    mRenderSurfaceView.setEGLConfigChooser(8, 8, 8, 8, 24, 0);
    mRenderSurfaceView.setRenderer(mEngine, this);
    mRenderSurfaceView.getHolder().setFormat(PixelFormat.RGBA_8888);

    this.setContentView(mRenderSurfaceView, BaseGameActivity.createSurfaceViewLayoutParams());
}


@Override
public void onAttachedToWindow() {
    super.onAttachedToWindow();
    Window window = getWindow();
    window.setFormat(PixelFormat.RGBA_8888);
}


    
[3] eeeeeer 二
    来源: 互联网  发布时间: 2014-02-18
eeeeeer 2
eeeeeer 22

    
最新技术文章:
▪Android开发之登录验证实例教程
▪Android开发之注册登录方法示例
▪Android获取手机SIM卡运营商信息的方法
▪Android实现将已发送的短信写入短信数据库的...
▪Android发送短信功能代码
▪Android根据电话号码获得联系人头像实例代码
▪Android中GPS定位的用法实例
▪Android实现退出时关闭所有Activity的方法
▪Android实现文件的分割和组装
▪Android录音应用实例教程
▪Android双击返回键退出程序的实现方法
▪Android实现侦听电池状态显示、电量及充电动...
▪Android获取当前已连接的wifi信号强度的方法
▪Android实现动态显示或隐藏密码输入框的内容
▪根据USER-AGENT判断手机类型并跳转到相应的app...
▪Android Touch事件分发过程详解
▪Android中实现为TextView添加多个可点击的文本
▪Android程序设计之AIDL实例详解
▪Android显式启动与隐式启动Activity的区别介绍
▪Android按钮单击事件的四种常用写法总结
▪Android消息处理机制Looper和Handler详解
▪Android实现Back功能代码片段总结
▪Android实用的代码片段 常用代码总结
▪Android实现弹出键盘的方法
▪Android中通过view方式获取当前Activity的屏幕截...
▪Android提高之自定义Menu(TabMenu)实现方法
oracle iis7站长之家
▪Android提高之MediaPlayer播放网络音频的实现方法...
▪Android提高之MediaPlayer播放网络视频的实现方法...
▪Android提高之手游转电视游戏的模拟操控
 


站内导航:


特别声明:169IT网站部分信息来自互联网,如果侵犯您的权利,请及时告知,本站将立即删除!

©2012-2021,,E-mail:www_#163.com(请将#改为@)

浙ICP备11055608号-3