小编Kru*_*nal的帖子

将整数添加到NSMUtableArray

我是一名新的iPad开发人员.

我按下按钮实现UIPopover,popover包含整数值,

当我试图用整数填充我的数组时它向我显示SIGABRT:索引3超出界限我无法看到我的日志,应用程序崩溃.

这是我的代码片段:

-(void)btnClick:(id)sender {

    for (int i=3; i<=31; i++) {
        [remindarray addObject:[NSNumber numberWithInteger:i]];
         NSLog(@"no=%@",[remindarray objectAtIndex:i]);
    }

    UIViewController* popoverContent = [[UIViewController alloc]init];
    UIView* popoverView = [[UIView alloc] initWithFrame:CGRectMake(110, 0, 500, 4)];

    popoverTable = [[UITableView alloc]initWithFrame:CGRectMake(0, 0, 250, 665) style:UITableViewStylePlain];
    [popoverTable setDelegate:(id<UITableViewDelegate>)self]; 
    [popoverTable setDataSource:(id<UITableViewDataSource>)self]; 
    [self.view addSubview:popoverTable];
    [popoverTable release];

    [popoverView addSubview:popoverTable];
    popoverContent.view = popoverView;
    popoverContent.contentSizeForViewInPopover = CGSizeMake(250, 600);
    self.popoverController = [[UIPopoverController alloc]
                              initWithContentViewController:popoverContent];

    [self.popoverController  presentPopoverFromRect:CGRectMake(100,0, 535, 35) 
                                             inView:self.view permittedArrowDirections:UIPopoverArrowDirectionRight animated:YES];

    [popoverView release];
    [popoverContent release];
}
Run Code Online (Sandbox Code Playgroud)

最后remind …

iphone integer nsmutablearray ipad uipopovercontroller

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

Apple会在自动布局警告中拒绝我的应用吗?

我制作了针对iOS 6的iPhone应用程序

我的应用程序运行非常顺利,并且在应用程序中以及应用程序中的任何位置都没有崩溃..但我的应用程序显示了一些与之相关的警告autolayout.

我试了很多来解决这个警告,但我没有成功..

NSLog中的警告:

Unable to simultaneously satisfy constraints.
    Probably at least one of the constraints in the following list is one you don't want. Try this: (1) look at each constraint and try to figure out which you don't expect; (2) find the code that added the unwanted constraint or constraints and fix it. (Note: If you're seeing NSAutoresizingMaskLayoutConstraints that you don't understand, refer to the documentation for the UIView property translatesAutoresizingMaskIntoConstraints) 
(
    "<NSAutoresizingMaskLayoutConstraint:0xac85e50 h=-&- v=-&- …
Run Code Online (Sandbox Code Playgroud)

iphone warnings ipad ios6 nslayoutconstraint

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

Xcode 4.5没有创建xib文件

我已经创建了基于SimpleView的应用程序,其中我想添加带.xib接口的新文件但是当我添加新文件然后Objective-C class然后子类的UITableViewCell选项with xib for user interface被禁用时我也想添加xib ..

如何添加带.xib接口的新文件?

这是截图.. 1 2 谢谢阅读..

iphone xib ipad ios xcode4.5

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

stringByReplacingOccurrencesOfString不起作用

我想用一些其他组件替换myurl中的一些组件,但它不起作用..

这是我的代码段:

NSString *Url =@"http://www.myData.com/pageId=aaa&pageSize=bbb&page=2"
Run Code Online (Sandbox Code Playgroud)

在上述网址我想取代aaastr1bbbstr2..

    [Url stringByReplacingOccurrencesOfString:@"aaa" withString:str1];
    [Url stringByReplacingOccurrencesOfString:@"bbb" withString:str2];

    NSLog(@"Final Url = %@",Url);
Run Code Online (Sandbox Code Playgroud)

最后当我看到我的日志,Final Url不替换aaastr1,并bbbstr2..

谢谢阅读...

iphone nsstring ipad ios

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

将文件下载到iPhone中的文件夹

我是iPhone新手,

当用户下载任何下载的内容时,我制作了应用程序 DocumentDirectory

我想在我创建的文件夹中下载 DocumentDirectory

怎么做到这一点?

我以为我会将文件下载到我的DocumentDirectory,我会将该文件移到我的文件夹里面DocumentDirectory.

这是好习惯吗?

这是我的代码片段,但我仍然无法移动我的文件.

- (BOOL)webView:(UIWebView*)webView shouldStartLoadWithRequest:(NSURLRequest*)request navigationType:(UIWebViewNavigationType)navigationType {

    NSString *file = [NSString stringWithString:[url absoluteString]];
    NSURL *fileURL = [NSURL URLWithString:file];

    NSURLRequest *req = [NSURLRequest requestWithURL:fileURL];
    [NSURLConnection connectionWithRequest:req delegate:self];


    NSString *DestPath=[[[SourcePath stringByAppendingString:@"/"]stringByAppendingString:BookCateg]stringByAppendingString:@"/"];

                   if ([fm copyItemAtPath:SourcePath toPath:DestPath error:&error]) 
                   {
                      NSLog(@"Success !");
                   }
                  else{
                      NSLog(@"Fail to Move!");
                   }

}
Run Code Online (Sandbox Code Playgroud)

我的日志显示 Fail to Move!

任何帮助将不胜感激.

iphone nsfilemanager ipad ios nsdocumentdirectory

0
推荐指数
1
解决办法
6576
查看次数

在0到2.0范围内将UISlider增加0.2

可能重复:
在1到100的范围内将UISlider增加1

我是iPhone新手,

如何让我的UISlider从0增加到2,增量为0.2?

slider = [[UISlider alloc] init];
[slider addTarget:self action:@selector(sliderChange:) forControlEvents:UIControlEventValueChanged];
[slider setBackgroundColor:[UIColor clearColor]];
slider.minimumValue = 0.0;
slider.maximumValue = 2.0;
slider.continuous = YES;
slider.value = 0.0;

- (IBAction)sliderChange:(id)sender{
    NSLog(@"slider.value=%f",slider.value);
}
Run Code Online (Sandbox Code Playgroud)

当我滑动我的日志显示...

slider.value = 1.000000
slider.value = 1.123440
slider.value = 1.234550
slider.value = 1.345670
slider.value = 1.567890
.
.
.
Run Code Online (Sandbox Code Playgroud)

我希望滑块值为0.0,0.2,0.4等等......

任何帮助都会得到满足.

iphone uislider ipad ios

0
推荐指数
1
解决办法
3038
查看次数

Vb6中需要运行时错误424对象

我是Vb新手,

我的源代码中出现错误,

这是我的代码段,

Dim a,b as integer 
  a=val (txtf.Text)
  b=val (txts.Text)
    if(a>b)then
       txtr=a
    else
      txtr=b
   end if 
end sub
Run Code Online (Sandbox Code Playgroud)

错误:运行时错误424对象必需:

任何帮助都会得到帮助。

vb6

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

以毫秒iOS转换DateTime

我有日期和时间,我想要的是特定日期和时间的毫秒数

例如:日期21-04-2015 和日期(2015年4月21日)的时间是14:23

然后以毫秒为单位输出是1429606437692 我想要的没有毫秒从1970年到今天的日期最多14:23 如何得到这个日期时间在毫秒iOS中?

请提前帮助和感谢.

iphone datetime objective-c ipad ios

0
推荐指数
1
解决办法
8272
查看次数