我按照下面的方式在导航栏中添加了一个条形按钮
UIBarButtonItem *cancel = [[UIBarButtonItem alloc] initWithTitle:@"CANCEL" style:UIBarButtonItemStyleBordered target:self action:@selector(goToPreviousView)];
self.navigationItem.leftBarButtonItem = cancel;
Run Code Online (Sandbox Code Playgroud)
现在我想在RED Color中显示Text"CANCEL".
我的意思是我需要更改条形按钮项目上的文本,而不是按钮的色调颜色.
怎么做?
在我的应用程序中,我UITextView在文本视图下方有一个按钮,可以UITextView在编辑时插入照片.
我的要求是用户用户能够在其中编辑文本,并在需要时插入图像.
与StackOverflow的应用程序类似UITextView:

直到现在我已经UITableView通过填充数据库中的内容来实现
通过从sqlite数据库中检索数组
storedContactsArray = [Sqlitefile selectAllContactsFromDB];
所以没有多个部分,节标题和返回storedContactsArray.count行数.
现在我需要在表视图中填充相同的数据,但是按字母顺序在Alpabetical部分中设置数据.
我试过了
alphabetsArray =[[NSMutableArray alloc]initWithObjects:@"A",@"B",@"C",@"D",@"E",@"F",@"G",@"H",@"I",@"J",@"K",@"L",@"M",@"N",@"O",@"P",@"Q",@"R",@"S",@"T",@"U",@"V",@"W",@"X",@"Y",@"Z",nil];
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
return [alphabetsArray count];
}
- (NSArray *)sectionIndexTitlesForTableView:(UITableView *)tableView {
return alphabetsArray;
}
- (NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section {
return [alphabetsArray objectAtIndex:section];
}
Run Code Online (Sandbox Code Playgroud)

但是在numberOfRowsInSection的情况下它失败了,因为storedContactsArray最初没有接触
发生错误: -[__NSArrayM objectAtIndex:]: index 25 beyond bounds for empty array
-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
return [[storedContactsArray objectAtIndex:section] count]
}
Run Code Online (Sandbox Code Playgroud)
任何建议使用完整链接请
在我的iPhone应用程序中,我需要在图像视图中设置图像.
图像视图高度始终为100像素.
we need to set the width of the image view with respect to the original image scale ratio.
即每个假设宽度X图像的高度为300x400(原始)(4x3)
我们显示的图像视图图像大小为75X100
图像宽度X高度为512x512(原始)(1x1)
我们显示的图像视图图像大小为100X100
宽度X图像的高度为128 x 256(原始)(1x2)
我们显示的图像视图图像大小为50X100
in all those cases image view height 100pixel should be same, but the width need to varie with respect to the image ratio.
最后,图像视图应位于视图的中心
如何实现它
iphone ×4
objective-c ×4
ipad ×2
uiimageview ×2
ios ×1
sqlite ×1
uiimage ×1
uitableview ×1
uitextview ×1
xcode ×1