目前我只知道如何将字符串作为标题:
[self setTitle:@"iOS CONTROL"];
Run Code Online (Sandbox Code Playgroud)
或带图像
self.navigationItem.titleView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"icon.png"]];
Run Code Online (Sandbox Code Playgroud)
但不是两个在同一时间
有解决方案吗?谢谢
使用"NSLog"显示对象数组的解决方案是什么.
我可以用我的TableView显示它:
- (UITableViewCell *)tableView:(UITableView *)tableView
cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
UITableViewCell *cell = [tableView
dequeueReusableCellWithIdentifier:@"MyBasicCell2"];
DataOrder *bug = [[[ArrayBuying instance] tableau] objectAtIndex:indexPath.row];
static NSString *CellIdentifier = @"MyBasicCell2";
CustomCellFinalView *Cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (!Cell) {
Cell = [[CustomCellFinalView alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier];
}
Cell.NomProduit.text = bug.product;
Cell.Quantite.text = [NSString stringWithFormat:@"%.2f €", bug.price];
Cell.Prix.text = [NSString stringWithFormat:@"X %d ", bug.quantite];
return Cell;
return cell;
}
Run Code Online (Sandbox Code Playgroud)
当我尝试我的ViewDidLoad:方法时
NSLog(@"%@",[[ArrayBuying instance] tableau]);
Run Code Online (Sandbox Code Playgroud)
我在目标输出中获得:
(
"<DataOrder: 0x15d5d980>",
"<DataOrder: 0x15de1aa0>"
)
Run Code Online (Sandbox Code Playgroud)
非常感谢您的未来帮助
我该如何实施- (NSString *)description
?
我做:
- (NSString *)description{
NSString *descriptionString = [NSString stringWithFormat:@"%@",[self tableau]];
return descriptionString;
}
Run Code Online (Sandbox Code Playgroud)
并添加到我的ViewController中
NSLog(@"%@",[[[ArrayBuying instance] tableau] description]);
Run Code Online (Sandbox Code Playgroud)
我刚刚获得:
2013-12-03 10:47:50.323 ApplicationTest2[561:60b] (
"<DataOrder: 0x156eb090>",
"<DataOrder: 0x16926340>"
)
Run Code Online (Sandbox Code Playgroud)
非常感谢你