小编Ell*_*iot的帖子

有没有办法在Xcode中显示iPhone调试器控制台的颜色代码?

我观察到Android程序员使用LogCat来查看彩色的Debugger Console输出.看起来你可以让不同的类以不同的颜色进行调试输出.在开发iPhone时这可能吗?

iphone debugging console xcode colors

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

在Obj-C中过度使用点运算符的替代方法是什么?

看看你对这行代码的看法:

if ([pickerViewController.picker.bvc.currentResolve.name isEqualToString:message])
  ...
Run Code Online (Sandbox Code Playgroud)

你会认为这是过度使用点运算符吗?

如果没有,我可以保持原样.

但如果是这样,那么首选的替代方案是什么?

oop design-patterns coding-style objective-c

4
推荐指数
1
解决办法
474
查看次数

iPhone Obj-C错误:在Xcode中分配只读变量'prop.149'

我正在使用Objective-C编写iPhone应用程序.

这是Xcode给我的错误:

error: assignment of read-only variable 'prop.149'
Run Code Online (Sandbox Code Playgroud)

代码:

// Create CATransition object
CATransition *transition = [CATransition animation];
// Animate over 3/4 of a second
transition.duration = 0.75;
// using the ease in/out timing function
transition.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut];
// Set transition type
transition.type = kCATransitionPush;
// Next line gives error: assignment of read-only variable 'prop.149'
transition.subtype = (flipsideView.hidden == YES ? kCATransitionFromRight : kCATransitionFromLeft);
Run Code Online (Sandbox Code Playgroud)

错误意味着什么,我该如何解决?

iphone xcode objective-c variable-assignment

4
推荐指数
1
解决办法
2659
查看次数

C++传递对象的副本与将指针传递给对象?

这是我的Game类的构造函数:

// Construct a Game to be played with player on a copy of the board b.
Game(const Board& b, Player* player)
{
  ...
}
Run Code Online (Sandbox Code Playgroud)

这是我使用构造函数的方式:

Player p("Player Name");
Board b(6,3);
Game g(b, &p);
Run Code Online (Sandbox Code Playgroud)

这是如何运作的?被复制了吗?

如果我想保存指向播放器的指针,我应该创建如下的私有ivar吗?

private:
  Player* _player;

...
// In Game constructor
_player = player;
Run Code Online (Sandbox Code Playgroud)

c++ constructor pointers class

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

为什么PHP没有看到我的查询字符串?

这个phpinfo()演示了这个问题.

我正在向URL传递一个查询字符串:

?qwerty=asdfg
Run Code Online (Sandbox Code Playgroud)

因此,我希望它列出这两个PHP变量:

_REQUEST["qwerty"] asdfg
_GET["qwerty"] asdfg
Run Code Online (Sandbox Code Playgroud)

还有这个查询字符串:

_SERVER["QUERY_STRING"] qwerty=asdfg
Run Code Online (Sandbox Code Playgroud)

但是,它不起作用.似乎根本没有设置这些变量.

我正在使用lighttpd.这可能与问题有关,也可能与此无关,但我的greengar.com-lighttpd.conf看起来像这样,因为我在大多数域名网页上使用WordPress:

### Generated by Elliot
### Wordpress: http://www.greengar.com
url.rewrite += (
    "^/(wp-.+).*/?" => "$0",
    "^/(blog/wp-.+).*/?" => "$0",
    "^/(.*.php)" => "$0",
    "^/(.*.pdf)" => "$0",
    "^/(.*.png)" => "$0",
    "^/(.*.html)" => "$0",
    "^/(.*.ico)" => "$0",
    "^/(.*.gif)" => "$0",
    "^/(.*.txt)" => "$0",
    "^/(images).*/?" => "$0",
    "^/(sitemap.xml)" => "$0",
    "^/(xmlrpc.php)" => "$0",
    "^/(.+)/?$" => "/index.php/$1"
)
Run Code Online (Sandbox Code Playgroud)

同样,我不确定这是否与问题有关.

我的问题是:为什么PHP看不到查询字符串?

我该如何解决?

这是一个普通的phpinfo(),可以成功查看查询字符串.这是在运行Apache的其他服务器上运行的.

php parameters query-string

3
推荐指数
1
解决办法
3440
查看次数

glError:在iPhone上加载OpenGL ES的大纹理时为0x0501?

这是我用来加载纹理的代码.图像是CGImageRef.使用此代码加载图像后,我最终使用glDrawArrays()绘制图像.

    size_t imageW = CGImageGetWidth(image);
    size_t imageH = CGImageGetHeight(image);
    size_t picSize = pow2roundup((imageW > imageH) ? imageW : imageH);

    GLubyte *textureData = (GLubyte *) malloc(picSize * picSize << 2);
    CGContextRef imageContext = CGBitmapContextCreate( textureData, picSize, picSize, 8, picSize << 2, CGImageGetColorSpace(image), kCGImageAlphaNoneSkipLast | kCGBitmapByteOrder32Big );  

    if (imageContext != NULL) {
        CGContextDrawImage(imageContext, CGRectMake(0.0, 0.0, (CGFloat)imageW, (CGFloat)imageH), image);    
        glGenTextures(1, &textureId);   
        glBindTexture(GL_TEXTURE_2D, textureId);

        // when texture area is small, bilinear filter the closest mipmap
        glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
        // when texture area is large, …
Run Code Online (Sandbox Code Playgroud)

iphone opengl-es

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