小编Atu*_*ain的帖子

UIDocumentInteractionController的奇怪问题

我不知道这段代码有什么问题,但每当我运行应用程序时,在显示菜单后,应用程序崩溃.

NSString * path = [[NSBundle mainBundle] pathForResource:@"tung" ofType:@"doc"];

UIDocumentInteractionController *docController = [UIDocumentInteractionController interactionControllerWithURL:[NSURL fileURLWithPath:path]];

docController.delegate = self;

//[docController presentPreviewAnimated:YES];

CGRect rect = CGRectMake(0, 0, 300, 300);
[docController presentOptionsMenuFromRect:rect inView:self.view animated:YES];
Run Code Online (Sandbox Code Playgroud)

我得到的错误:

***由于未捕获的异常'NSGenericException'终止应用程序,原因:' - [UIPopoverController dealloc]到达,而popover仍然可见.

我现在应该怎么做 ?

iphone document ipad

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

如何播放本地视频文件?

我用我的屏幕(桌面)捕获软件创建了.mov视频文件,我想在UIWebview中的应用程序中播放该视频.有没有办法播放该视频或任何其他方式,以便我可以为我的本地视频创建一个URL ???

现在我使用默认视频链接在UIWebview中播放视频.

这是代码:

- (void)applicationDidBecomeActive:(UIApplication *)application 
{

    self.viewVideoDisplay.frame = CGRectMake(0, 0, 1024, 1024);
    [self.window addSubview:self.viewVideoDisplay];
    [self.window bringSubviewToFront:self.viewVideoDisplay];
    NSString *urlAddress = @"https://response.questback.com/pricewaterhousecoopersas/zit1rutygm/";
    //Create a URL object.
    NSURL *url = [NSURL URLWithString:urlAddress];            
    //URL Requst Object
    NSURLRequest *requestObj = [NSURLRequest requestWithURL:url];            
    //Load the request in the UIWebView.
    [self.webViewVideo loadRequest:requestObj];

    IsLoadingSelf = YES;
}
Run Code Online (Sandbox Code Playgroud)

但是我没有想要播放的视频网址..

请帮助!!

iphone video objective-c uiwebview ios

14
推荐指数
2
解决办法
4万
查看次数

防止MKMapView不断重新缩放并重新定位到用户位置

我似乎与许多发布在这里的人有相反的问题MKMapView.我似乎无法让它停止这样做,而不是无法让它缩放并显示当前位置.这是发生的事情:

  • 我启动了应用程序
  • MKMapView用蓝点显示我的位置
  • 我用手指在地图上缩小和缩小
  • 几秒钟后,MKMapView突然再次缩放到我当前位置的中心位置

我试图告诉我CLLocationManagerstopUpdatingLocation(没有任何影响,因为一个MKMapView知道如何使用CoreLocation),我尝试了告诉MKMapViewsetShowsUserLocation:NO(无蓝点显示在所有的,这不是我想要的).我甚至试图消除我的CLLocationManager(没有效果).造成这种情况的原因是什么?如何阻止它?


是的,我确实设置了位置管理员的准确性和距离-loadView.

我没有实施-mapViewDidFinishLoadingMap:.这是我的实施

-locationManager:didUpdateToLocation:fromLocation:
- (void)locationManager:(CLLocationManager *)manager didUpdateToLocation:(CLLocation *)newLocation fromLocation:(CLLocation *)oldLocation
{
    // How many seconds ago was this new location created?
    NSTimeInterval t = [[newLocation timestamp] timeIntervalSinceNow];

    // CLLocationManagers will return the last found location of the device first,
    // you don't want that data in this case. If this location was …
Run Code Online (Sandbox Code Playgroud)

iphone location zooming mkmapview

11
推荐指数
1
解决办法
4200
查看次数

NSTextCheckingResult用于电话号码

有人能告诉我为什么每次评估都是真的吗?!

输入是:jkhkjhkj.我输入的phone字段并不重要.它每次都是真的......

NSRange range = NSMakeRange (0, [phone length]);    
NSTextCheckingResult *match = [NSTextCheckingResult phoneNumberCheckingResultWithRange:range phoneNumber:phone];
if ([match resultType] == NSTextCheckingTypePhoneNumber)
{
    return YES;
}
else 
{
    return NO;
}
Run Code Online (Sandbox Code Playgroud)

这是值match:

(NSTextCheckingResult *) $4 = 0x0ab3ba30 <NSPhoneNumberCheckingResult: 0xab3ba30>{0, 8}{jkhkjhkj}
Run Code Online (Sandbox Code Playgroud)

我正在使用RegEx,NSPredicate但我已经读过,因为iOS4建议使用,NSTextCheckingResult但我找不到任何好的教程或示例.

提前致谢!

iphone validation objective-c ios5

11
推荐指数
1
解决办法
7905
查看次数

从战争外部加载Log4j.xml

在我的应用程序中,我使用Log4j进行日志记录.目前我将log4j.xml放在WEB-INF/classes中.以下是我用来加载log4j.xml文件的配置.

<!-- language: xml -->

    <context-param>
          <param-name>log4jConfigLocation</param-name>
         <param-value>/WEB-INF/classes/log4j.xml</param-value>
    </context-param>

    <listener>
       <listener-class>org.springframework.web.util.Log4jConfigListener</listener-class>
    </listener> 
Run Code Online (Sandbox Code Playgroud)

现在我需要将log4j.xml文件放在war文件之外.该位置很可能是JBOSS_HOME/server/default/deploy/settings.在设置目录中,我需要放置我的log4j.xml.

我尝试通过编辑run.bat设置jboss类路径加载它,如下所示设置JBOSS_CLASSPATH =%RUN_CLASSPATH%;%JBOSS_HOME%\ server\default\deploy\settings我在web.xml下面使用

<!-- language: xml -->

    <context-param>
            <param-name>log4jConfigLocation</param-name>
            <param-value>classpath:/log4j.xml</param-value>  
    </context-param>

    <listener>
            <listener-class>org.springframework.web.util.Log4jConfigListener</listener-class>
    </listener> 
Run Code Online (Sandbox Code Playgroud)

但它在部署应用程序时抛出异常.例外是 java.lang.IllegalArgumentException: Invalid 'log4jConfigLocation' parameter: class path resource [/log4j.xml] cannot be resolved to URL because it does not exist

现在我的问题是如何加载它.

log4j

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

连续滚动UILabel就像选框一样

以下是我的代码,用于滚动UILabel水平,使其显示为选框效果.但是动画开始于标签位于中心并滚动直到它的宽度,并再次从中心滚动统计数据.我想要从左到右连续滚动字幕.任何身体都可以帮助我.

-(void)loadLabel{

    if (messageView) {
        [messageView removeFromSuperview];
    }

    NSString *theMessage = text;
    messageSize = [theMessage sizeWithFont:font];
    messageView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, messageSize.width, 916)]; //x,y,width,height
    [messageView setClipsToBounds:NO]; // With This you prevent the animation to be drawn outside the bounds.
    [self.view addSubview:messageView];
    lblTime = [[RRSGlowLabel alloc] initWithFrame:CGRectMake(0, 0, messageSize.width, 916)]; //x,y,width,height
    [lblTime setBackgroundColor:[UIColor yellowColor]];
    lblTime.font = font;
    [lblTime setText:theMessage];
    lblTime.glowOffset = CGSizeMake(0.0, 0.0);
    lblTime.glowAmount = 90.0;
    lblTime.glowColor = color;
    [lblTime setClipsToBounds:NO];
    [lblTime setTextColor:color];
    [lblTime setTextAlignment:UITextAlignmentLeft];
    lblTime.frame = messageView.bounds ; //x,y,width,height …
Run Code Online (Sandbox Code Playgroud)

cocoa-touch objective-c marquee uilabel ios

10
推荐指数
0
解决办法
2万
查看次数

NSURLRequest:如何将httpMethod"GET"更改为"POST"

GET方法,它工作正常.

网址:http://myurl.com/test.html?query = id = 123& name = kkk


我没有POST方法的概念.请帮我.

我如何将GET方法转换为POST方法?


网址:http://testurl.com/test.html

[urlRequest setHTTPMethod:@"POST"];

iphone post nsurlrequest ios

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

NSAffinetransform和CGAffinetransform之间的区别

有没有人有任何好的例子来解释NSAffinetransformCGAffinetransform?之间的区别?谢谢

iphone cgaffinetransform

8
推荐指数
1
解决办法
826
查看次数

实施Apple推送通知的步骤是什么?

我是这个主题的新手,需要在我的应用程序中实现Apple推送通知的一些指导.我创建了我的appID,并为此同时配置了Apple推送通知.我已下载配置文件并在iphone上安装了该应用程序.我还编写了Apple文档提供的以下代码

- (void)application:(UIApplication *)app didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)devToken
{
    const void *devTokenBytes = [devToken bytes];
    NSLog(@"devToken=%@",devTokenBytes);
    //self.registered = YES;
    //[self sendProviderDeviceToken:devTokenBytes]; // custom method
}

- (void)application:(UIApplication *)app didFailToRegisterForRemoteNotificationsWithError:(NSError *)err
{
    NSLog(@"Error in registration. Error: %@", err);
}
Run Code Online (Sandbox Code Playgroud)

我想知道我必须在服务器端写什么.当我运行代码时,它表示设备未注册.如何注册推送通知的应用程序.

谁能帮我这个...

任何代码都会非常有用......

提前完成了...

iphone objective-c apple-push-notifications

7
推荐指数
1
解决办法
1186
查看次数

UIAlertView委托中的UIAlertView Click事件

我是iPhone开发人员的新手,

我想一个接一个地实现2个警报视图,比如当用户按下删除按钮时,第一个警报视图会询问Are you sure want to Delete ?两个按钮yesno

现在,如果用户按下yes,则第二个警报视图将显示消息Deleted Successfully !此警报视图仅包含OK按钮,现在单击此OK按钮我想调用一个方法.

如果用户按下No则不会发生任何事情,警报应该解除.

这是我的代码片段,

-(void)DeletebtnCliked:(id)sender
{   
    UIAlertView* alertView = [[UIAlertView alloc] initWithTitle:@"Are you sure want to delete ?"
                                                        message:nil delegate:self 
                                              cancelButtonTitle:nil
                                              otherButtonTitles:@"Yes",@"No",nil];
    [alertView show];
    [alertView release];   
}

- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex
{ 
    if (buttonIndex == 0)
    {            
         UIAlertView* alertew = [[UIAlertView alloc] initWithTitle:@"Deleted Successfully !"
                                                           message:nil delegate:self 
                                                 cancelButtonTitle:@"OK"
                                                 otherButtonTitles:nil];
        [alertew show];
        [alertew release];

        if (buttonIndex == …
Run Code Online (Sandbox Code Playgroud)

iphone buttonclick uialertview ipad

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