我在iPhone上使用XMPP框架作为我的聊天应用程序.我想使用XMPP框架从我的应用程序发送图像.任何人都可以建议我,怎么做?
任何帮助,将不胜感激.
嗨所有我想在我目前在我的视图中保存图像,但问题是,我只能保存一个图像,如果我想保存另一个图像,它取代旧的.我没有得到如何然后将多个图像保存在捆绑中.这是我的代码.
- (void)writeImageToDocuments:(UIImage*)image
{
NSData *png = UIImagePNGRepresentation(image);
NSArray *paths=NSSearchPathForDirectoriesInDomains(NSDocumentDirectory,NSUserDomainMask, YES);
NSString *documentsDirectory = [paths objectAtIndex:0];
NSError *error = nil;
[png writeToFile:[documentsDirectory stringByAppendingPathComponent:@"image.png"] options:NSAtomicWrite error:&error];
}
Run Code Online (Sandbox Code Playgroud)
请帮帮我,如何保存多个图像,文件等捆绑
提前致谢
我有使用NSTimer的问题,代码如下,我简化了代码:
- (void) mainThreadFun
{
[NSTimer scheduledTimerWithTimeInterval:0.02 target:self selector:@selector(test) userInfo:nil repeats:YES];
dispatch_async(dispatch_get_global_queue(0, 0), ^{
[NSTimer scheduledTimerWithTimeInterval:0.02 target:self selector:@selector(test1) userInfo:nil repeats:YES];
});
}
Run Code Online (Sandbox Code Playgroud)
我发现mainThread中的NSTimer工作但是另一个线程中的NSTimer不起作用.为什么会发生这种情况?我该如何解决这个问题?
我想检查在文本字段中输入的字段是否是电子邮件.如果其电子邮件字段然后继续显示一些警告或错误.我不知道如何验证该字段.请帮帮我
我有一个包含5个部分的表格视图,我已将tableview选项设置为多个.每个部分都有不同的行数.我想要的是设置用户只能从每个部分中选择一个单元格(在我的表格中,用户可以选择任意数量的单元格).例:来自5个部分的5个细胞.
从任何部分选择多个单元格应该是不可能的.如果用户从同一部分选择另一个单元格,则应取消选择先前选择的单元格.我怎样才能做到这一点.这是didSelectRowAtIndexPath的示例实现.
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
HoteldetalcelloneTableViewCell *cellone = (HoteldetalcelloneTableViewCell *)[self.detailtableView cellForRowAtIndexPath:indexPath];
HoteldetailcelltwoTableViewCell *celltwo = (HoteldetailcelltwoTableViewCell *)[self.detailtableView cellForRowAtIndexPath:indexPath];
//I have implement for two sections to test.
if(indexPath.section == 0)
{
HotelDetailsone *secone = [roomonearray objectAtIndex:indexPath.row];
HoteldetailsforBooking *book = [HoteldetailsforBooking new];
if([secone.offerallow isEqualToString:@"True"])
{
celltwo.selectedsignLabel.hidden = NO;
}
else
{
cellone.selectedsignLabelone.hidden = NO;
}
// [self.detailtableView reloadData];
NSLog(@"price for room 1 : %@", secone.itempriceText);
}
else
{
HotelDetailsone *sectwo = [roomtwoarray objectAtIndex:indexPath.row];
HoteldetailsforBooking *book = [HoteldetailsforBooking new];
if([sectwo.offerallow isEqualToString:@"True"]) …Run Code Online (Sandbox Code Playgroud) objective-c uitableview didselectrowatindexpath ios sections