小编Mat*_*Mat的帖子

如何从UIImagePickerController中选择任何视频或电影文件

在我的应用程序中,我需要选择任何视频文件并在应用程序中显示视频文件的URL.

-(void)viewDidLoad{

    [super viewDidLoad];

    self.imgPicker = [[UIImagePickerController alloc] init];
    self.imgPicker.delegate = self;
    self.imgPicker.sourceType = UIImagePickerControllerSourceTypeSavedPhotosAlbum;
    self.imgPicker.mediaTypes = [NSArray arrayWithObjects:(NSString *)kUTTypeMovie, (NSString *)kUTTypeImage, nil];
    self.imgPicker.allowsEditing = NO;

    [self presentModalViewController:self.imgPicker animated:YES];
}

-(void)imagePickerControllerDidCancel:(UIImagePickerController *)picker{

    [picker dismissModalViewControllerAnimated:YES];
}


-(void)imagePickerController:(UIImagePickerController *)picker
      didFinishPickingImage : (UIImage *)image
                 editingInfo:(NSDictionary *)editingInfo{

}

- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info{

    value = 1;

    IMAGE_COUNTER = IMAGE_COUNTER + 1;

    NSString* mediaType = [info objectForKey:UIImagePickerControllerMediaType]; 
    if ( [mediaType isEqualToString:@"public.movie" ])
    {
        NSLog(@"Picked a movie at URL %@",  [info objectForKey:UIImagePickerControllerMediaURL]);
        NSURL *url =  [info …
Run Code Online (Sandbox Code Playgroud)

iphone uiimagepickercontroller

27
推荐指数
2
解决办法
5万
查看次数

如何在不删除蓝点的情况下从MKMapView中删除所有注释?

我想从我的mapview中删除所有注释,而不是我的位置的蓝点.我打电话的时候:

[mapView removeAnnotations:mapView.annotations];
Run Code Online (Sandbox Code Playgroud)

删除所有注释.

如果注释不是蓝点注释,我可以通过哪种方式检查(如所有注释的for循环)?

编辑(我用这个解决了):

for (int i =0; i < [mapView.annotations count]; i++) { 
    if ([[mapView.annotations objectAtIndex:i] isKindOfClass:[MyAnnotationClass class]]) {                      
         [mapView removeAnnotation:[mapView.annotations objectAtIndex:i]]; 
       } 
    }
Run Code Online (Sandbox Code Playgroud)

iphone mkmapview mkannotation

26
推荐指数
5
解决办法
3万
查看次数

如何确定注释是否在MKPolygonView(iOS)中

我正在尝试计算特定注释(如用户位置的蓝色圆圈)或MKPinAnnotation是否在mapview上的MKPolygon图层内.

有什么建议来实现这个目标

mkmapview ios mkpolygonview

26
推荐指数
2
解决办法
8737
查看次数

我如何获得当前日期?

如何获取当前日期,并将其格式化为"20/12/2010"?

iphone cocoa cocoa-touch date objective-c

19
推荐指数
2
解决办法
3万
查看次数

如何为iPhone上的UITableView创建交替颜色的行?

我会有另外两种颜色的行,如第一个黑色,第二个白色,第三个黑色等等......

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *CellIdentifier = @"Cell";
cell = ((MainCell*)[tableView dequeueReusableCellWithIdentifier:CellIdentifier]);
if (cell==nil) {

    NSArray *topLevelObjects=[[NSBundle mainBundle] loadNibNamed:@"MainCell"    owner:self options:nil];

    for (id currentObject in topLevelObjects){
        if ([currentObject isKindOfClass:[UITableViewCell class]]){
            if ((indexPath.row % 2)==0) {
                [cell.contentView setBackgroundColor:[UIColor purpleColor]];

            }else{
                [cell.contentView setBackgroundColor:[UIColor whiteColor]];

            }
            cell =  (MainCell *) currentObject;
            break;
        }
    }

}else {

    AsyncImageView* oldImage = (AsyncImageView*)
    [cell.contentView viewWithTag:999];
    [oldImage removeFromSuperview];
}return cell;
Run Code Online (Sandbox Code Playgroud)

问题是,当我进行快速滚动时,细胞的背景变得像最后2个细胞黑色,前2个细胞白色或类似的东西,但如果我滚动慢工作正常.我认为问题是reusableCell的缓存.

有任何想法吗?

TIA

cocoa-touch objective-c cell uitableview ios

10
推荐指数
1
解决办法
9197
查看次数

是否可以在MKAnnotationView而不是MKPinAnnotationView中调用animatesDrop?

你知道吗MKPinAnnotationView有一个方法"animatesDrop"来动画一个引脚注释从顶部到地图上的阴影点?好的,是否可以使用自定义图像执行此操作?

iphone view mkannotation

9
推荐指数
1
解决办法
7770
查看次数

xCode 3和SDK iOS 5(可能吗?)

有谁知道我是否可以使用xCode 3.2.6来实现基于iOS 5的应用程序?

提前致谢.

iphone xcode ios5

5
推荐指数
1
解决办法
9030
查看次数

UITextField中的Keypressed事件

我有10个文本字段,在每个文本字段中我只能输入一个字符.在每个文本字段中输入字符后,焦点应移至下一个字段.类似地,当我通过按退格键或删除来删除文本字段中的字符时,我需要将焦点转到上一个文本字段.如果我能得到keypressed事件,我可以做到这一点.现在我无法找到任何按键事件示例.

iphone uitextfield ios

3
推荐指数
1
解决办法
7680
查看次数

安全删除包含标签的子视图

这不是一个真正的问题,我只想澄清一下.我在UIButton上添加了一些子视图(每个按钮都有一个标签),我知道可能有4个或5个子视图.所以,当我想删除一些子视图(特别是在这种情况下的第4和第5):

int cnt=[[(UIView *)[self.scrollView viewWithTag:index] subviews] count];
  if (cnt==4) {
      [[[(UIView *)[self.scrollView viewWithTag:index] subviews] objectAtIndex:3] removeFromSuperview];
  }
  if (cnt==5) {
      [[[(UIView *)[self.scrollView viewWithTag:index] subviews] objectAtIndex:3] removeFromSuperview];
    //[[[(UIView *)[self.scrollView viewWithTag:index] subviews] objectAtIndex:4] removeFromSuperview]; <-- this crash
      [[[(UIView *)[self.scrollView viewWithTag:index] subviews] objectAtIndex:3] removeFromSuperview];

    }
Run Code Online (Sandbox Code Playgroud)

当然,评论行无法执行,因为没有更多5个,但有4个子视图.所以我必须删除在同一索引上指向两次的视图.我想知道它是否是一种安全的方法来删除它们,我想确保最后一个视图移动到阵列中较低的位置[[self.scrollView viewWithTag:index] subviews].

希望很清楚.谢谢

tags iphone ios subviews

3
推荐指数
1
解决办法
6442
查看次数

iPhone错误ld:/Users/Shared/PhoneGap/Frameworks/PhoneGap.framework/PhoneGap中的重复符号_SBJSONErrorDomain

我正在尝试创建Phonegap项目,其中我需要集成ASIHTTPRequest和JASON参考,

并得到以下错误

ld:/Users/Shared/PhoneGap/Frameworks/PhoneGap.framework/PhoneGap和/Users/Alliancetek/Library/Developer/Xcode/DerivedData/HelloPhoneGap1-dwnmrmnkqwhiuoaagvbogktdnmlb/Build/Intermediates/HelloPhoneGap1.build/Debug-iphonesimulator/中的重复符号_SBJSONErrorDomain架构i386的HelloPhoneGap1.build/Objects-normal/i386/SBJsonBase.o命令/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/clang失败,退出代码为1

请帮忙.

iphone json cordova

3
推荐指数
1
解决办法
1314
查看次数

为ZBarReaderViewController添加一个uibarbutton

我正在研究ZBarReader,到目前为止我所拥有的是

ZBarReaderViewController *controller = [[ZBarReaderViewController alloc] init];
controller.navigationController.navigationBarHidden = NO;
// Add Edit button to the right and handle click event UIBarButtonItem *manualButton = [[UIBarButtonItem alloc] initWithTitle:@"Manual" style:UIBarButtonItemStyleBordered target:self action:@selector(EditMode:)];
[controller.navigationItem setRightBarButtonItem:manualButton];
controller.readerDelegate = self;
[self presentModalViewController:controller animated:YES];
Run Code Online (Sandbox Code Playgroud)

我的问题是我们可以如此上面这样的事情:设置工具栏可见并在其上添加ZBarReaderViewController的按钮.

iphone

2
推荐指数
1
解决办法
1747
查看次数

如何制作一个显示下拉菜单的按钮?

我是iPhone开发使用的新手,xcode 3.2.6我想知道如何在导航栏中创建一个按钮,它将显示一个下拉列表,其中包含一个列表,我将编程执行该操作.怎么做?

iphone xcode menu ios drop-down-menu

2
推荐指数
1
解决办法
3106
查看次数