问题列表 - 第32627页

中心在UITableViewCell问题中对齐文本

我是Objective-C和iPhone开发的新手,在尝试将文本放在表格单元格中时遇到了一个问题.我搜索了谷歌,但解决方案是针对旧的SDK错误已修复,这些对我不起作用.

一些代码:

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {

    cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
    if (cell == nil) {
        cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:CellIdentifier] autorelease];
    }

    cell.textLabel.text = @"Please center me";
    cell.textLabel.textAlignment = UITextAlignmentCenter;
    return cell;
}
Run Code Online (Sandbox Code Playgroud)

以上内容并非文本的中心.

我也试过了willDisplayCell方法:

- (void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath {
    cell.textLabel.textAlignment = UITextAlignmentCenter;
}
Run Code Online (Sandbox Code Playgroud)

我尝试了一些旧的解决方案:

UILabel* label = [[[cell contentView] subviews] objectAtIndex:0];
label.textAlignment = UITextAlignmentCenter;
return cell;
Run Code Online (Sandbox Code Playgroud)

这些都不会对文本对齐产生任何影响.我已经没有想法了,任何帮助都会受到最高的赞赏.

提前干杯.

iphone objective-c ios4

64
推荐指数
3
解决办法
6万
查看次数

Facebook"喜欢"按钮和#URL字符串?

Facebook如果指的是同一页面但使用不同的#字符串,那么ajax web应用程序中的'Like'按钮会是什么?

它是否将它们视为"喜欢"的不同页面?

例如,如果我得到4次点击:

mysite.com/articles#story1
mysite.com/articles#story2
mysite.com/articles#story3
mysite.com/articles#story4
Run Code Online (Sandbox Code Playgroud)

用户的新闻源会出现什么

4 people like mysite.com/articles
Run Code Online (Sandbox Code Playgroud)

要么

dave likes mysite.com/articles#story1
tom likes mysite.com/articles#story2
ben likes mysite.com/articles#story3
nick likes mysite.com/articles#story4
Run Code Online (Sandbox Code Playgroud)

FB和#strings还有其他什么需要考虑的事情吗?

javascript ajax facebook

9
推荐指数
1
解决办法
7283
查看次数

运算符优先级“ pow”和“ root”

我正在写一个小小的整数计算器,它包含两个二进制运算符“ pow”和“ root”。“ pow”运算符求值(左操作数)^(右操作数),而“ root”运算符求出最大数n,以使n ^(左操作数)<=(右操作数)。

假设这不是荒谬的事情,那么这些运算符的优先级应该是什么?目前,我的优先级相同,因此字符串

3 root 1500 pow 7
Run Code Online (Sandbox Code Playgroud)

从左到右评估。这是正确的吗?我应该把这个问题放在mathoverflow吗?

algorithm

0
推荐指数
1
解决办法
1106
查看次数

DateTime :: createFromFormat - php格式问题

PHP - DateTime :: createFromFormat - 返回根据指定格式格式化的新DateTime对象

这工作:

$var = DateTime::createFromFormat('Ymd','20100809')->getTimestamp();
Run Code Online (Sandbox Code Playgroud)

但这失败了

在非对象上调用成员函数getTimestamp()

$var = DateTime::createFromFormat('Y/m/d H:M:S','2010/08/09 07:47:00')->getTimestamp();
Run Code Online (Sandbox Code Playgroud)

php format timestamp

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

你能用十个原语实现任何纯LISP函数吗?(即没有类型谓词)

本网站提出以下声明:http: //hyperpolyglot.wikidot.com/lisp#ten-primitives

McCarthy introduced the ten primitives of lisp in 1960. All other pure lisp 
functions (i.e. all functions which don't do I/O or interact with the environment) 
can be implemented with these primitives. Thus, when implementing or porting lisp, 
these are the only functions which need to be implemented in a lower language. The 
way the non-primitives of lisp can be constructed from primitives is analogous to 
the way theorems can be proven from axioms in mathematics. …

lisp types predicate function clojure

10
推荐指数
1
解决办法
1370
查看次数

哪里可以为我的C++项目找到一个好的Scope Guard实现?

我刚刚了解了Scope Guard C++习语.不幸的是,我找不到任何好的实现.

有人能指出我在C++中使用一些好的和可用的Scope Guard实现吗?

谢谢,Boda Cydo.

c++ scope guard

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

使用PorterDuff模式擦除位图部件

我尝试使用Porter-Duff Xfermodes在我的Android应用程序中擦除部分位图.

我有一个绿色背景,由蓝色位图覆盖.当我触摸屏幕时,应该创建覆盖位图中的"洞",使绿色背景可见.而不是一个洞,我当前的代码产生一个黑点.

以下是我的代码.任何想法,我在这里做错了什么?

/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
            WindowManager.LayoutParams.FLAG_FULLSCREEN);
    setContentView(new DrawView(this));
}

public class DrawView extends View implements OnTouchListener {

    private int x = 0;
    private int y = 0;

    Bitmap bitmap;
    Canvas bitmapCanvas;

    private final Paint paint = new Paint();
    private final Paint eraserPaint = new Paint();

    public DrawView(Context context) {
        super(context);
        setFocusable(true);
        setFocusableInTouchMode(true);

        this.setOnTouchListener(this);

        // Set background
        this.setBackgroundColor(Color.GREEN);

        // Set bitmap
        bitmap = Bitmap.createBitmap(320, 480, …
Run Code Online (Sandbox Code Playgroud)

android image-manipulation

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

为什么我的mysql_real_escape_string不起作用?

我读过很多关于SQL注入的内容.但它不适用于此代码:

$inputform= $_GET["password"];
$query = "INSERT INTO user(password) VALUES ('".mysql_real_escape_string($inputform)."')";  
Run Code Online (Sandbox Code Playgroud)

例如,我使用这个例子:O'Conner.当我提交它并查看我的表时,有O'Connor没有O\'Conner.

谢谢

php mysql

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

是否有Cruise Control .NET的API?

我可以使用Cruise Control .NET(ccnet)查询服务器的API,例如获取各种构建的状态吗?

我注意到ccnet托盘应用程序中有一些选项可供连接,但我找不到服务API的任何文档或如何使用它的示例.

.net c# api cruisecontrol.net continuous-integration

29
推荐指数
3
解决办法
5789
查看次数

我怎么知道服务器是否启用了JSONP?

我怎么知道服务器是否启用了JSONP?它不是我的服务器,但我尝试从渲染的html访问一些信息.

提前致谢.

javascript jquery json

11
推荐指数
2
解决办法
4831
查看次数