Tag: 客观

获取重新sorting的UITableViewCells的顺序

我正在尝试将单元格的重新sorting索引放入数组中。 在viewDidLoad cell.showsReorderControl = YES; arrayTag = [NSMutableArray array]; //创build单元格时将indexPath.row另存为cell.tag。 – (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { ….. cell.tag = indexPath.row; NSString *strCellTag = [NSString stringWithFormat:@"%d",cell.tag]; if(![arrayTag containsObject:strCellTag]) { [arrayTag addObject:strCellTag]; } return cell; } / /我不知道这是正确的方式,但下面我试图保存对数组的更改。 – (NSIndexPath *)tableView:(UITableView *)tableView targetIndexPathForMoveFromRowAtIndexPath:(NSIndexPath *)sourceIndexPath toProposedIndexPath:(NSIndexPath *)proposedDestinationIndexPath { [arrayTag replaceObjectAtIndex:sourceIndexPath.row withObject:[NSString stringWithFormat:@"%i",proposedDestinationIndexPath.row]]; [arrayTag replaceObjectAtIndex:proposedDestinationIndexPath.row withObject:[NSString stringWithFormat:@"%i",sourceIndexPath.row]]; return […]

如何在iOS objective-C中为vr应用程序并排显示相机的两个预览?

我试图为vr应用程序并排实现两个摄像机视图。 我在这个网站find了一些有用的信息: 如何同时显示2个相机预览?[对于纸板应用程序] 但我想如何创build与iOS? 我正在尝试与AVFoundation创build相同的行为。 这是我现在的代码 CameraViewController #import <AVFoundation/AVFoundation.h> #import "CameraViewController.h" @interface CameraViewController () @property (strong, nonatomic) AVCaptureSession *captureSession; @property (strong, nonatomic) AVCaptureStillImageOutput *stillImageOutput; @property (strong, nonatomic) AVCaptureVideoPreviewLayer *previewLayerLeft; @property (strong, nonatomic) AVCaptureVideoPreviewLayer *previewLayerRight; @end @implementation CameraViewController #pragma mark – lazy instantiation – (AVCaptureSession *)captureSession { if (!_captureSession) _captureSession = [[AVCaptureSession alloc] init]; return _captureSession; […]

如何区分UITableView自定义部分点击和部分第一行点击?

UITableView返回相同的callback“ didSelectRowAtIndexPath ”与相同的NSIndexPath (0,0)节点击和节第一行单击。 我使用自定义视图的部分标题视图,我需要对这些部分行执行一些操作。 尝试使用[tableView cellForRowAtIndexPath:indexPath]检查单元类,但它显然返回相同的行单元,而不是部分单元格。 有什么build议么? 更新我可以将我的自定义部分视图添加到第一行,而不是将其添加为一个部分,但是在这种情况下,我需要返回不同的行高度在“ heightForRowAtIndexPath ”,这将不是表演明智的决定。 更新我已经devise了我的部分视图作为UITableViewCell的子类,因为我更喜欢本机UITableViewcallback,而不是解决方法与轻拍手势或button。

将存储在NSArray中的图像添加到UITableView

首先,我是编程新手,我试图创build一个具有UITableView的应用程序,并显示存储在数组中的名称,并在每个名称之外显示图像(图标)。 我已经添加了三个图像,并命名为1.jpg , 2.jpg和3.jpg 。 该应用程序运行良好,但告诉应用程序后,我想要显示的数组中存储的图像和运行的应用程序的iOS模拟器的工作,但然后我在我的main.m文件中得到一个绿色的错误? 以下是我的实现文件: NSMutableArray *myImages; NSMutableArray *myNames; @implementation ViewController – (void)viewDidLoad { [super viewDidLoad]; // Do any additional setup after loading the view, typically from a nib. myNames = [[NSMutableArray alloc ]initWithObjects:@"A",@"B",@"C", nil]; for (int imageNumber =1 ; imageNumber <= 3; imageNumber++) { myImages= [[NSMutableArray alloc]initWithObjects:[[NSString stringWithFormat:@"%i.jpg", imageNumber ]], nil]; } […]

删除button在UITableview的编辑模式下滚动消失

我在编辑模式下滚动tableview时遇到问题。 这是因为细胞的可重用性。 我在编辑模式下的链接UITableView – 滚动删除buttonDissapears 没有从这一点。 这是我的代码片段 – – (void)setEditing:(BOOL)editing animated:(BOOL)animated { [super setEditing:editing animated:animated]; [tableView setEditing:editing animated:animated]; [tableView setAllowsMultipleSelectionDuringEditing:editing]; } – (UITableViewCellEditingStyle)tableView:(UITableView *)tableView editingStyleForRowAtIndexPath:(NSIndexPath *)indexPath { return UITableViewCellEditingStyleDelete; } – (BOOL)tableView:(UITableView *)tableview shouldIndentWhileEditingRowAtIndexPath:(NSIndexPath *)indexPath { return NO; } – (BOOL)tableView:(UITableView *)tableview canMoveRowAtIndexPath:(NSIndexPath *)indexPath { return YES; } – (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { […]

出现键盘时偏移UITableView内容

嗨我得到的错误:属性'editingIndexPath'没有find对象的types'ViewController *'与行: [self.tableView scrollToRowAtIndexPath:self.editingIndexPath atScrollPosition:UITableViewScrollPositionTop animated:YES]; 这个错误与这个调用有关: self.editingIndexPath 我将如何解决这个错误? – (void)viewDidLoad { [super viewDidLoad]; // Do any additional setup after loading the view, typically from a nib. [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardWillShow:) name:UIKeyboardWillShowNotification object:nil]; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardWillHide:) name:UIKeyboardWillHideNotification object:nil]; } – (void)keyboardWillShow:(NSNotification *)notification { CGSize keyboardSize = [[[notification userInfo] objectForKey:UIKeyboardFrameBeginUserInfoKey] CGRectValue].size; UIEdgeInsets contentInsets; if (UIInterfaceOrientationIsPortrait([[UIApplication […]

法语在iOS上的语音识别

我正在尝试开发一个使用法语语音识别的iOS应用程序,但直到现在还没有成功。 我尝试过使用openEars框架,这对于英语非常适用,但不支持法语。 我用这个链接的一些信息。 如果有人知道一个解决scheme,那就太棒了。 谢谢

本地通知声音没有播放?

我遇到了本地通知的问题,他们没有播放声音。 我用默认的和自定义的那个进行了testing,显然是我想玩的,但没有任何东西! 我看了很多人面对这个问题,但他们的解决scheme没有为我工作。 UILocalNotification *local – (IBAction)Dateaction:(id)sender { local = [[UILocalNotification alloc]init]; local.timeZone = [NSTimeZone defaultTimeZone]; local.alertBody = [NSString stringWithFormat:@"%@ Recuerda que tienes que: %@", [[NSUserDefaults standardUserDefaults] objectForKey:@"user"], [[NSUserDefaults standardUserDefaults] objectForKey:@"selected"]]; local.fireDate = [self.DatePicker date]; /* if ([[self.userdefaults objectForKey:@"sound"]isEqualToString:@"sound1"]) { local.soundName = @"sound1.caf"; }else if([[self.userdefaults objectForKey:@"sound"]isEqualToString:@"sound2"]){ local.soundName = @"sound2.caf"; }else if([[self.userdefaults objectForKey:@"sound"]isEqualToString:@"sound1"]){ local.soundName = @"sound3.caf"; […]

如何在iOS中使用CAGradientLayer在UITableViewCell中设置多个渐变颜色?

我想设置多个渐变颜色,每行将具有独特的渐变颜色,如下图所示: 我想实现的是第一个图像,我能实现的是第二个 我写的代码是我能够实现的 BackgroundLayer.h +(CAGradientLayer *)CustomHorBlack; BackgroundLayer.m + (CAGradientLayer*) CustomHorBlack { UIColor *colorOne = [UIColor colorWithRed:(0.0) green:(0.0 ) blue:(0.0) alpha:0.1]; UIColor *colorTwo = [UIColor colorWithRed:(0.0) green:(0.0 ) blue:(0.0) alpha:0.2]; UIColor *colorThree = [UIColor colorWithRed:(0.0) green:(0.0 ) blue:(0.0) alpha:0.3]; UIColor *colorFour = [UIColor colorWithRed:(0.0) green:(0.0 ) blue:(0.0) alpha:0.4]; UIColor *colorFive = [UIColor colorWithRed:(0.0) green:(0.0 ) blue:(0.0) […]

iOS强制景观在一个viewController

先生, 我正在使用mapview模块,其中风景是唯一的方向允许,但其他只有肖像。 当在设备上运行ios 7和8时,视图控制器仍然呈现为纵向,除非我必须手动将设备转为横向。 你能告诉我还有什么其他的步骤吗? 以下是我的代码 AppDelegate.h @interface AppDelegate : UIResponder <UIApplicationDelegate> @property (strong, nonatomic) UIWindow *window; @property (nonatomic) BOOL isTaskPoint; @end AppDelegate.m – (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { if (UIInterfaceOrientationIsPortrait(interfaceOrientation)) return YES; return NO; } PreviousController.m MapViewController * sliderVC = [[MapViewController alloc] init ]; AppDelegate *appDelegate = (AppDelegate *) [UIApplication sharedApplication].delegate; appDelegate.isTaskPoint = TRUE; sliderVC.modalPresentationStyle = UIModalPresentationCurrentContext; […]