Tag: 客观

iOS UITableViewCellAccessoryCheckmark每次滚动都可见

我有一个列表,我用它作为checkbox。 我已启用或禁用选中行上的复选标记。 但是当我滚动列表中的每10行之后的标记行。 – (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { UITableViewCell *oldCell = [tableView cellForRowAtIndexPath:indexPath]; if (oldCell.accessoryType == UITableViewCellAccessoryCheckmark) { oldCell.accessoryType = UITableViewCellAccessoryNone; } else { oldCell.accessoryType = UITableViewCellAccessoryCheckmark; } }

如何使iOS6 iPad中的单元更宽

我有一个为iPad和iPhonedevise的应用程序。 对于iPhone来说,一切都可以,但是在iOS6平台的iPad版本中,单元格的左侧和右侧有一个额外的空间 – 在iOS7中没关系。 你可以在下一个截图的故事板中看到它们: 和细胞的大小: 我怎样才能删除这个额外的空间?

当tableView滚动时,tableViewCells中的运行计时器被覆盖

我已经试过多次询问这个问题,但是我一直没能解释发生了什么事情。 也许一些屏幕截图可能有帮助。 我只能发布一个,因为我没有足够的声望点。 在tableview滚动后截图 您可以看到其中一个定时器(2)已被重置。 我试图解决这个多种方式没有成功。 下面是将定时器放入tableview单元的代码: -(void) calculateTimer:(NSTimer *)theTimer { self.timerItem = [theTimer userInfo]; // for date only cell if(self.timerItem.timerType == 0){ [theTimer invalidate]; } for (NRCItemCell *cell in [self.tableView visibleCells]) { NSIndexPath *ip = [self.tableView indexPathForCell:cell]; NSUInteger row = [[[NRCItemStore sharedStore]allItems] indexOfObjectIdenticalTo:self.timerItem]; if (row == ip.row){ [self configureTimers:cell forRowAtIndexPath:ip]; cell.timer.text = self.timerItem.timerOutput; cell.timerName.text […]

cellForRowAtIndexPath中的框不会更改

我想在某些情况下更改cellForRowAtIndexPath单元格内的x位置的view框架。 我已经使用了下面的代码。 但是它不会改变视图的x position框架。 – (void)viewDidLoad { [super viewDidLoad]; UINib *nib = [UINib nibWithNibName:@"GoalDetailsCustomCardCell" bundle:nil]; [goalDetailsTableView registerNib:nib forCellReuseIdentifier:@"CardCell"]; } – (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { GoalDetailsTableViewCell *cell = [goalDetailsTableView dequeueReusableCellWithIdentifier:@"CardCell"]; if(cell == nil) { cell = [goalDetailsTableView dequeueReusableCellWithIdentifier:@"CardCell"]; } NSLog(@"%f", cell.cardDetails.frame.origin.x); [UIView animateWithDuration: 0.5 animations:^{ cell.cardDetails.frame = CGRectOffset(cell.cardDetails.frame, -322.0, 0.0); // CGRectOffset(cell.cardView.frame, -320.0, 0.0); […]

在两个UITableViewCells之间添加一个视图(图像视图)

我已经编程创build了一个UITableView 。 我正在加载数据。 我想在每4行之后插入一个广告横幅(与单元格的高度和宽度相等的可点击的button)到这个table view 。 可以插入吗? 或者我应该添加一些数组,我正在加载表视图? 提前致谢。

在uitableviewcell中asynchronous加载图像

我正在尝试在UITableVIewasynchronous加载图像。 – (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{ UITableViewCell *cell = nil; NSString *cellIndetify = [NSString stringWithFormat:@"cell%d",tableView.tag -TABLEVIEWTAG]; cell = [tableView dequeueReusableCellWithIdentifier:cellIndetify]; IndexPath *_indextPath = [IndexPath initWithRow:indexPath.row withColumn:tableView.tag – TABLEVIEWTAG]; if (cell == nil) { cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellIndetify]; cell.selectionStyle = UITableViewCellSelectionStyleNone; cell.contentView.backgroundColor = [UIColor blackColor]; // here I init cell image view UIView […]

为什么我的UITableView在5行之后重复行?

我有7行在我的数据库。 我确认,所有的数据都成功地通过NSLog的postArray给出7的iOS端。然而,当我运行我的应用程序,它将只显示前5行,然后前2行,而不是第6和第7行从我的数据库。 另外,当我从我的第六和第七文本查看实际的文本查看正确的文本在那里…为什么它重复5行后? 谢谢。 这是我的代码: #import "DailyViewController.h" #import "Post.h" @interface DailyViewController () @end @implementation DailyViewController – (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil { self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil]; if (self) { // Custom initialization } return self; } – (void)viewDidLoad { [super viewDidLoad]; // View background [self.view setBackgroundColor:[UIColor colorWithRed:(255/255.0) green:(221/255.0) blue:(85/255.0) alpha:1.0f]]; NSURL *url = [NSURL URLWithString:[NSString […]

文本到语音转换

我们正在iPhone应用程序客户端需要提醒作为语音信息。 要求是用户会设置他们想要提醒的时间和文字。 使用文本,我将转换为语音,并在提醒被触发时播放audio文件。 为此,我计划使用谷歌服务 http://www.translate.google.com/translate_tts?tl=ar&q=%D9%85%D8%B1%D8%AD%D8%A8%D8%A7%20%D8%B5%D8%AF%D9 %8A%D9%82%D8%8C%20%D9%83%D9%8A%D9%81%20%D8%AD%D8%A7%D9%84%D9%83%D8%9F http://www.translate.google.com/translate_tts?tl=en&q=helloE%20friend 播放这些文本并下载相同的audio文件。 NSString* userAgent = @"Mozilla/5.0"; NSURL *url = [NSURL URLWithString:[@"http://www.translate.google.com/translate_tts?tl=en&q=helloE%20friend" stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]]; NSMutableURLRequest* request = [[[NSMutableURLRequest alloc] initWithURL:url] autorelease]; [request setValue:userAgent forHTTPHeaderField:@"User-Agent"]; NSURLResponse* response = nil; NSError* error = nil; NSData* data = [NSURLConnection sendSynchronousRequest:request returningResponse:&response error:&error]; [data writeToFile:@"/var/tmp/tts.mp3" atomically:YES]; 我可以使用这些代码,但客户端不想上网。 有没有任何图书馆可以做文字到语音转换没有互联网(如siri正在做)? 任何有关这方面的信息将是伟大的。

支持使用AVCaptureSession进行video的后台录制

我正在尝试在后台录制video,但是目前我的代码是在前台录制video时,应用程序将背景的方法。 -(void)captureOutput:(AVCaptureFileOutput *)captureOutput didFinishRecordingToOutputFileAtURL:(NSURL *)outputFileURL fromConnections:(NSArray *)connections error:(NSError *)error 立即发生错误 error:Error Domain=AVFoundationErrorDomain Code=-11818 "Recording Stopped" UserInfo=0x176aa180 {NSLocalizedRecoverySuggestion=Stop any other actions using the recording device and try again., NSUnderlyingError=0x1766c0e0 "The operation couldn't be completed. (OSStatus error -16133.)", NSLocalizedDescription=Recording Stopped} 我在DemoApp-Info.plist中设置了以下值 Required background modes->App plays audio or streams audio/video using AirPlay Application does not run in background->NO […]

iOS:如何查询WiFi状态

是否有可能以编程方式查询iOS上的WiFi状态(启用/禁用)? 当启用WiFi并且设备没有连接到任何networking时,查询应该返回true。 编辑:我意识到由Reachability类提供的function,据我所知,它不承认启用,但没有连接状态的WIFI。 即下面的代码将返回NetworkStatus NotReachable ,这不是我所需要的。 Reachability* r = [Reachability reachabilityForLocalWiFi]; NetworkStatus ns = [r currentReachabilityStatus];