小编Luc*_*uca的帖子

尽管我删除了Default.png,但仍会显示启动画面

我不再需要启动画面,我已经从资源文件中删除了Default.png,我也删除了睡眠功能.但是,当我运行应用程序时,启动画面仍然存在,你能帮我找出它仍然显示的原因吗?提前致谢 :)

ios

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

异常[NSNull isEqualToString:]:当我点击calloutAccessoryControlTapped时无法识别的选择器

我有一个异常的问题,实际上,当我点击calloutAccessoryControlTapped引脚的按钮我得到这个例外,我试图通过NSLog控制台跟踪错误,我发现导致此异常的唯一引脚有值<null>,我通过一些代码解释:

for (int i=0; i<[array count]; i++) {
           NSDictionary *stationEnCours=[array objectAtIndex:i];
           location2D = (CLLocationCoordinate2D){ .latitude = lat, .longitude = lng };
           MyLocation *annotation=[[[MyLocation alloc]initWithName:ensStation distanceVersLaStation:distance coordinate:location2D]autorelease];

//here we set the properties before we get call to addAnnotation annotation.stationAdress=[stationEnCours objectForKey:@"ssiphone_adresse"];
           NSLog(@"%@",annotation.stationAdress);
           [mapView addAnnotation:annotation];
}
Run Code Online (Sandbox Code Playgroud)

我有4个站,在控制台我得到了这个:

2011-05-11 22:27:11.768 TopStation[2370:207] A 51 - Aire de la Champouse
2011-05-11 22:27:11.769 TopStation[2370:207] <null>
2011-05-11 22:27:11.769 TopStation[2370:207] 467 Avenue Henri Mauriat
2011-05-11 22:27:11.769 TopStation[2370:207] Route de Berre - Jas de …
Run Code Online (Sandbox Code Playgroud)

json web-services objective-c ios

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

尝试检索字符串值时发送到实例的无法识别的选择器

我有一个NSMutablearray包含NSArrays(每个数组包含int和String值).当我尝试从第一个数组中检索并显示数据时:对于int值,这是正常的,它已正确显示.

    NSLog(@"%i",[[[lesQuestions objectAtIndex:0] objectAtIndex:0] intValue]);
Run Code Online (Sandbox Code Playgroud)

但是当我尝试显示String值时:

    NSLog(@"%@",[[[lesQuestions objectAtIndex:0] objectAtIndex:1] stringValue]);
Run Code Online (Sandbox Code Playgroud)

我有例外:

Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSCFString stringValue]: unrecognized selector sent to instance
Run Code Online (Sandbox Code Playgroud)

我绝对肯定int值是第一项(索引0)而String值是第二项(索引1).当我记录持有NSArrays的MutableArray时,我得到了正确的值,所以问题在于我猜的项目的引用.

objective-c nsmutablearray nsarray ios

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

str_replace似乎不适用于implode函数

在插入数组之后:

$in_list = "'".implode("','",$array)."'";
Run Code Online (Sandbox Code Playgroud)

$in_list 内容是:

'Robert','Emmanuel','José','Alexander'
Run Code Online (Sandbox Code Playgroud)

现在,当我尝试José用另一个字符串替换单词时,

    str_replace("José","J",$in_list);
Run Code Online (Sandbox Code Playgroud)

它没有获得新的价值,José仍然存在.我错过了什么吗?提前.

php

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

转到另一个功能的标签

我需要这样做:

-(void)function1{
goto start;
}

-(void)function2{
//some code
start://i need to get in here exactly, [self function2] oblige me to execute the function2 from the beginning
//some code..
}
Run Code Online (Sandbox Code Playgroud)

似乎我不能,我能做什么呢?提前.

编辑:这是我的实际代码:

-(void)viewWillAppear:(BOOL)animated{
if (sqlite3_open(dbpath, &contactDB) == SQLITE_OK)
    {
        NSString *querySQL = [NSString stringWithFormat: 
                              @"Select quiz,question,p1,p2,p3,num_correct from question where quiz=(select id from quiz where nom = \'%@\' and niveau= \'%i\' and theme=(select id from theme where nom=\'%@\'))",nomPartieQuiz,quiIslam.theGameLevel,quiIslam.themeChoisie];

        const char *query_stmt = [querySQL UTF8String];

        if (sqlite3_prepare_v2(contactDB, 
                               query_stmt, -1, &statement, NULL) == …
Run Code Online (Sandbox Code Playgroud)

objective-c ios

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

点击后,UIButton得到了他的默认文本

当我在界面构建器上创建我的UIButton时,我放了一个像Button 1.

当我启动应用程序时,我以编程方式将文本更改为其他类似的内容:

btn1.titleLabel.text=@"Hello";
Run Code Online (Sandbox Code Playgroud)

一切都很好,直到我按下按钮,它得到了它的默认文本Button 1.

我的目的是,如果文本已经以编程方式更改,当我按下按钮时,它无法获取其默认文本值,我的意思是文本Hello应该保留.我该怎么办?提前Thanx :)

objective-c uibutton ios

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

比较两个UIColors在第一次没有工作

当我点击UIAlertView的OK按钮时,我需要更改视图的背景颜色,其默认颜色为白色,因此每次用户点击OK,我需要在两种颜色之间交替,例如白色和红色:

-(void)changeColor{

        if([self.view.backgroundColor isEqual: [UIColor whiteColor]]){

            self.view.backgroundColor=[UIColor redColor];
        }else {
            self.view.backgroundColor=[UIColor whiteColor];
        }
}
Run Code Online (Sandbox Code Playgroud)

问题是,在第一次OK点击时,颜色应该变成红色,但是它没有得到红色,所以我需要第二次单击OK按钮以获得带红色的视图背景颜色.我错过了第一次改变颜色的东西吗?

这是alertView:didDismissWithButtonIndex委托方法:

- (void)alertView:(UIAlertView *)alertView didDismissWithButtonIndex:(NSInteger)buttonIndex{


    if (buttonIndex==0) {
        //NSLog(@"It's Ok button which has been clicked");
        //Do whatever you want, commonly call to another function like so:
        [self changeColor];
    }else
        if (buttonIndex==1) {
            //NSLog(@"It's Cancel button which has been clicked");
        }

}
Run Code Online (Sandbox Code Playgroud)

uialertview ios

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