我在我的应用程序中播放声音,我想循环播放.我对此的研究并没有完全解决我的问题.
我的代码.m
CFBundleRef mainBundle = CFBundleGetMainBundle();
CFURLRef soundFileURLRef;
soundFileURLRef = CFBundleCopyResourceURL(mainBundle, (CFStringRef) @"ar4", CFSTR
("wav"), NULL);
UInt32 soundID;
AudioServicesCreateSystemSoundID (soundFileURLRef, &soundID);
AudioServicesPlaySystemSound (soundID);
Run Code Online (Sandbox Code Playgroud)
我想我需要把这样的东西放进去
numberOfLoops = -1;
Run Code Online (Sandbox Code Playgroud)
但不确定如何在我的代码中实现,因为我收到numberOfLoops的未声明错误.一些建议将非常感谢
由于标题表明我的活动指标处于状态不会停止动画.
我在这里做了一些研究,不知道我做错了什么......
在我的Apps委托中,我有
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
UIApplication* app = [UIApplication sharedApplication];
app.networkActivityIndicatorVisible = NO;
Run Code Online (Sandbox Code Playgroud)
在我的视图controller.m中,我想调用活动指示器
NSString *web = @"http://google.com";
NSURL *url = [NSURL URLWithString:web];
NSURLRequest *requestUrl = [NSURLRequest requestWithURL:url];
[toweb loadRequest:requestUrl];
UIApplication* app = [UIApplication sharedApplication];
app.networkActivityIndicatorVisible = YES; <<<<<<<<<<<<<<<<<<<<<
Run Code Online (Sandbox Code Playgroud)
现在继续问题我试图再次隐藏它:
- (void)DidFinishLoad:(UIWebView *)toweb{
[UIApplication sharedApplication].networkActivityIndicatorVisible = NO;
}
}
Run Code Online (Sandbox Code Playgroud)
任何建议表示赞赏
我正在创建一个通用的应用程序,并试图从相机胶卷中选择一个图像.在iPhone上工作正常,iPad想要弹出,所以已经这样做了,现在不断出错
-[UIPopoverController dealloc] reached while popover is still visible.
我研究过:
和谷歌,没有解决这个问题
现在,任何建议都表示赞赏
我已经在.h中实现了popover委托
.M
- (void)logoButtonPressed:(id)sender /////////////iPad requires seperate method ////////////////
{
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone) {
LogCmd();
UIImagePickerController *imagePicker = [[UIImagePickerController alloc] init];
imagePicker.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;
imagePicker.delegate = self;
imagePicker.allowsEditing = YES;
////////
imagePicker.modalPresentationStyle = UIModalPresentationCurrentContext;
////////
[self presentModalViewController:imagePicker animated:YES];
}
else
{
// We are using an iPad
UIImagePickerController *imagePickerController = [[UIImagePickerController alloc] init];
imagePickerController.delegate = self;
UIPopoverController *popoverController=[[UIPopoverController alloc] initWithContentViewController:imagePickerController];
popoverController.delegate=self;
[popoverController …Run Code Online (Sandbox Code Playgroud) 我想从自定义值自动完成文本字段
在这里研究了Google和SO UITextField Autocomplete - iPhone SDK
我试过这个:
- (BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string {
if ([string isEqualToString:@"Fac"]) {
_clientField.text = @"Factory";
}
return YES;
}
Run Code Online (Sandbox Code Playgroud)
问题是我没有输入预测值Factory,只输入了类型值Fac
编辑
根据答案尝试了这个...
- (BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string {
if ([string isEqualToString:@"Fac"]) {
_clientField.text = [_clientField.text stringByReplacingCharactersInRange:range
withString:@"Factory"];
}
return NO;
}
Run Code Online (Sandbox Code Playgroud)
还是一样
在我的应用程序中,如果用户从相机胶卷中选择一个图像作为compnay徽标(添加到最终的pdf),它可以将附加文件大小从8mb(没有图像)到29mb.当用户通过电子邮件发送文件时,这是一个问题,大多数服务器允许附件大小
- (IBAction)schemeLogoPressed:(id)sender {
LogCmd();
UIImagePickerController *imagePicker = [[UIImagePickerController alloc] init];
imagePicker.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;
imagePicker.delegate = self;
imagePicker.allowsEditing = NO;
[self.editController presentModalViewController:imagePicker animated:YES];
}
- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info
{
DebugLog(@"info dict: %@", info);
[picker dismissModalViewControllerAnimated:YES];
UIImage *image = [info objectForKey:UIImagePickerControllerOriginalImage];
self.schemeLogo.backgroundColor = [UIColor whiteColor];
self.schemeLogo.image = image;
NSData *imageData1 = UIImagePNGRepresentation(image);
NSString *path1 = [ICUtils pathForDocument:@"schemeLogo.png"];
[imageData1 writeToFile:path1 atomically:NO];
Run Code Online (Sandbox Code Playgroud)
我可以做些什么来优化拾取的图像大小?
如果通过iOS 7中的AirDrop发送从应用程序生成的PDF,有任何想法如何设置文档的标题?
通常搜索SO和文档没有回答我的问题
NSString *fileName = [NSString stringWithFormat:@"userCert_%@",self.certificate.reference];
NSData *cert = self.pdfData;
UIActivityViewController *activityCtr = [[UIActivityViewController alloc] initWithActivityItems:@[cert]
applicationActivities:nil];
NSMutableArray *excludedActivities = [self iOS6Activities].mutableCopy;
[excludedActivities addObject:UIActivityTypeAddToReadingList];
[excludedActivities addObject:UIActivityTypePostToFlickr];
[excludedActivities addObject:UIActivityTypePostToTencentWeibo];
[excludedActivities addObject:UIActivityTypePostToVimeo];
[activityCtr setExcludedActivityTypes:excludedActivities];
[self presentViewController:activityCtr
animated:YES
completion:nil];
Run Code Online (Sandbox Code Playgroud) 自从Swift 2即将到来
无法使用参数类型(productIdentifiers:Set)为类型SKproductsRequest调用初始值设定项
对于我的应用程序购买标识符 NSSet
if(SKPaymentQueue.canMakePayments()) {
let productID:NSSet = NSSet(objects:
"com.someurl.monthlyAutoRenewable",
"com.someurl.annualAutoRenewable")
let request: SKProductsRequest = SKProductsRequest(productIdentifiers: productID as Set<NSObject>)
request.delegate = self
request.start()
}
else {
}
Run Code Online (Sandbox Code Playgroud) 我一个接一个地连续显示两个警报视图,具体如下:
-IBAction
UIAlertView* alert = [[UIAlertView alloc] initWithTitle:@"Alert" message:@"my message" delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil];
[alert setDelegate:self];
[alert show];
}
- (void)didPresentAlertView:(UIAlertView *)alertView
{
[alertView setTitle:@"My new title"];
[alertView setMessage:@"My new message"];
}
Run Code Online (Sandbox Code Playgroud)
从第一个警报视图到第二个警报视图的转换速度非常快,用户没有时间阅读第一条消息.有人可以建议如何在警报之间添加延迟.我想我需要实现一个NSTimer,但实现这个我可以使用一些建议.
我在编译设备时遇到了以下错误
File is universal (3 slices) but does not contain a(n) armv7s slice: /Users/xxx/Desktop/xxxxxxx/DropboxSDK.framework/DropboxSDK for architecture armv7s
clang: error: linker command failed with exit code 1 (use -v to see invocation)
我已检查所有.m文件是否链接,一切正常,为什么它只在设备上执行此操作,编译器想要阻止它抱怨什么?
如果我有100个UITextFields,
myTextfFeld1,myTextField2......等等mytextField100
......他们都执行相同的动作,说变化myTextField1.alpha = 0.4来myTextField1.alpha = 1.
而不是写出100次这是一个更有效的方法来做到这一点
我在这里看一下iOS循环对象的属性并添加动作,但它仍然意味着将所有内容添加UITextFields到数组中.
ios ×10
objective-c ×8
cocoa-touch ×4
xcode ×4
dropbox ×1
ipad ×1
nsset ×1
pdf ×1
swift ×1
uialertview ×1