在我的应用程序中,我需要选择任何视频文件并在应用程序中显示视频文件的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) 我想从我的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) 我正在尝试计算特定注释(如用户位置的蓝色圆圈)或MKPinAnnotation是否在mapview上的MKPolygon图层内.
有什么建议来实现这个目标
如何获取当前日期,并将其格式化为"20/12/2010"?
我会有另外两种颜色的行,如第一个黑色,第二个白色,第三个黑色等等......
- (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
你知道吗MKPinAnnotationView有一个方法"animatesDrop"来动画一个引脚注释从顶部到地图上的阴影点?好的,是否可以使用自定义图像执行此操作?
有谁知道我是否可以使用xCode 3.2.6来实现基于iOS 5的应用程序?
提前致谢.
我有10个文本字段,在每个文本字段中我只能输入一个字符.在每个文本字段中输入字符后,焦点应移至下一个字段.类似地,当我通过按退格键或删除来删除文本字段中的字符时,我需要将焦点转到上一个文本字段.如果我能得到keypressed事件,我可以做到这一点.现在我无法找到任何按键事件示例.
这不是一个真正的问题,我只想澄清一下.我在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].
希望很清楚.谢谢
我正在尝试创建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
请帮忙.
我正在研究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开发使用的新手,xcode 3.2.6我想知道如何在导航栏中创建一个按钮,它将显示一个下拉列表,其中包含一个列表,我将编程执行该操作.怎么做?
iphone ×10
ios ×5
cocoa-touch ×2
mkannotation ×2
mkmapview ×2
objective-c ×2
xcode ×2
cell ×1
cocoa ×1
cordova ×1
date ×1
ios5 ×1
json ×1
menu ×1
subviews ×1
tags ×1
uitableview ×1
uitextfield ×1
view ×1