Tag: 客观

用UITableViewCellSelectionStyleGrayselect颜色的UIButton

我试图设置一个UIButton的颜色为'UITableViewCellSelectionStyleGray'; 问题是,UIButton的select颜色不能设置,只有图像。 有谁知道如何使图像与UITableViewCellSelectionStyleGray所选单元格的确切颜色?

应用程序崩溃在UItableCellSection长按

-(UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section { static NSString *simpleTableIdentifier = @"cell"; simpleCell = [self.dashboardListView dequeueReusableCellWithIdentifier:simpleTableIdentifier]; if (simpleCell == nil) { simpleCell = [[SimpleTableCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:simpleTableIdentifier]; simpleCell.selectionStyle = UITableViewCellSelectionStyleNone; } ///tap = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(sectionTapped)]; ///[simpleCell.contentView addGestureRecognizer:tap]; UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom]; [button setFrame:simpleCell.frame]; [button addTarget:self action:@selector(sectionTapped) forControlEvents:UIControlEventTouchUpInside]; [button setBackgroundColor:[UIColor clearColor]]; [simpleCell.contentView addSubview:button]; NSDictionary *dict = [cellnames […]

自定义UITableviewCell中的多行标签

我已经四处搜寻任何提示我的问题。 但我找不到解决scheme。 我做了UITableviewCell(FeedCell)的一个子类。 有一个图像和两个标签。 问题是我需要多行的标签不会显示多行。 我使用autolayot。 这是一个显示用户twitterfeed的应用程序。 我的代码: – (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { static NSString *CellIdentifier = @"Cell"; FeedCell *tweetCell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier]; if (tweetCell == nil) { tweetCell = [[FeedCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier]; [tweetCell.tweetText setNumberOfLines:0]; [tweetCell.tweetText setLineBreakMode:NSLineBreakByWordWrapping]; [tweetCell.tweetText setFont:[self fontForCell] ]; } NSDictionary *tweet = _dataSource[[indexPath row]]; NSString *tweetString = [tweet valueForKey:@"text"]; […]

在自定义UITableViewCell中调整UITextView的大小

我有一个自定义的UITableViewCell ,我试图根据内容的大小调整其内部的UITextView 。 我在iOS7上,并使用Autolayout。 我已经尝试使用以下内容: [cell.question setScrollEnabled:YES]; [cell.question sizeToFit]; [cell.question setScrollEnabled:NO]; 和 – (CGRect)textViewHeightForAttributedText: (NSAttributedString*)text andWidth: (CGFloat)width { UITextView *calculationView = [[UITextView alloc] init]; [calculationView setAttributedText:text]; CGSize size = [calculationView sizeThatFits:CGSizeMake(width, FLT_MAX)]; CGRect finalFrame = CGRectMake(0, 0, width, size.height); return finalFrame; } 来自不同的SOpost。 我可以调整框架。 但是问题是我无法看到变化。 从某种意义上说,当我login时,我可以看到变化。 但UITextView不会resize。 我无法find任何自动布局依赖关系。 当我禁用AutoLayout,它似乎工作。 我如何做到这一点,通过启用AutoLayout? 谢谢。 编辑 这是我的UITextView约束

如何使用目标c转换(.doc,.xls,.ppt)为pdf?

我能够在PDF文件上实现注释并将其导出。 但是在doc的情况下,xls和ppt我无法使用目标c应用注释? 所以我打算将(.doc,.xls,.ppt)文件转换为pdf格式。 使用UIKit或Quartz框架可能实现?

如何通过段button重新加载字典表中的字典单击使用目标C?

我需要用两个buttonUISegment control创build一个单一的tableview 。 我得到两个keys JSON响应两个不同的arrays 。 对于这两个键我创build了两个buttons 。 每当我点击段button之一,那么Schools关键值应该加载在tableview上。 每当我点击第二个分段button需要加载第二个键值colleges应该重新加载tableview上的数据,我想获得表cell点击获取值的所有键。 我的回复 : { "Schools" = { }; "colleges" = { A = { roll_no = 0; "name" = "SAMS"; }; B = { roll_no = 2; "name" = "SANF"; }; C = { roll_no = 3; "name" = "UDS"; }; } 我的代码: – (IBAction)Click_Segmentbutton:(id)sender { […]

iOS相机的亮度

我试图做一个应用程序,我必须像这个应用程序计算相机的亮度: http : //itunes.apple.com/us/app/megaman-luxmeter/id455660266?mt=8 我发现这个文件: http : //b2cloud.com.au/tutorial/obtaining-luminosity-from-an-ios-camera 但我不知道如何直接适应相机而不是图像。 这是我的代码: Image = [[UIImagePickerController alloc] init]; Image.delegate = self; Image.sourceType = UIImagePickerControllerCameraCaptureModeVideo; Image.showsCameraControls = NO; [Image setWantsFullScreenLayout:YES]; Image.view.bounds = CGRectMake (0, 0, 320, 480); [self.view addSubview:Image.view]; NSArray* dayArray = [NSArray arrayWithObjects:Image,nil]; for(NSString* day in dayArray) { for(int i=1;i<=2;i++) { UIImage* image = [UIImage imageNamed:[NSString stringWithFormat:@"%@%d.png",day,i]]; unsigned […]

如何创build多个本地通知

我试图创build多个本地通知,在我的应用程序,但由于某种原因只有第一通知stream行的起来,其余的只是不工作,这是我的代码。 我有一个名为criaAlertas的类,它负责创build通知,在这个类中我有以下方法: -(void)setarNotificacao:(NSInteger)quando nome:(UILocalNotification *)notification { UIApplication *myapp = [UIApplication sharedApplication]; notification.fireDate = [NSDate dateWithTimeIntervalSinceNow:quando]; notification.alertBody = @"Nice"; notification.timeZone = [NSTimeZone defaultTimeZone]; notification.soundName = UILocalNotificationDefaultSoundName; NSMutableArray *arrayOfNOtifications = [[NSMutableArray alloc]init]; [arrayOfNOtifications addObject:notification]; myapp.scheduledLocalNotifications = arrayOfNOtifications; } 所以我实例化了这个类的一个对象,并试图做到这一点: criaAlertas *novoAlerta = [[criaAlertas alloc]init]; UILocalNotification *notaUm = [[UILocalNotification alloc]init]; UILocalNotification *notaDois = [[UILocalNotification alloc]init]; [novoAlerta setarNotificacao:15 nome:notaUm]; […]

dynamicUITableView里面的静态单元格

我已经阅读了一些有关静态和dynamic单元格不兼容的主题,但是我想知道是否有一些解决scheme适用于我的情况。 我有一个静态表(由UITableViewController处理)。 我在其中一个单元格中放置了一个dynamic表格。 委托和数据源是两个表的UITableViewController ,只要内部dynamic表的行数小于静态表的行数,它就工作得很好。 当dynamic表比静态表有更多的单元格时,我得到一个index i beyond boundsexception的index i beyond bounds 。 我假设细胞的总数是静态定义和两个表共享,但不能真正了解到底发生了什么。 有人遇到类似的问题,并find解决办法? 编辑 这是我的numberOfRowsInSection方法。 在我的代理/数据源的每个方法中,我检查调用表是dynamic的(_tableOptions)还是静态的(在这种情况下,我调用父类的方法)。 – (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { if (tableView == _tableOptions) { // I return here the number of rows for the dynamic inner table } else { return [super tableView:tableView numberOfRowsInSection:section]; } } – (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath […]

有没有一种方法来确定在Objective-C中两个图像是否几乎相同?

假设你有两个图像: 和 除了几个不同颜色的像素外,这些图片几乎完全相同。 在Objective-C中有一种本地的方式来确定两张图片是否几乎相同 ? 如果没有, 还有另一种方法可以做到吗?