初学IOS遇到的各种问题汇总

一、错误警告代码:

warning: Unsupported Configuration: Scene is unreachable due to lack of entry points and does not have an identifier for runtime access via -instantiateViewControllerWithIdentifier:.

解释:新建项目时,选择了Emtpy Application模版。没有设置初始化进入的视图控制器


编译在CLI会出现下面的错误:

StoryboardApp[8593:207] Failed to instantiate the default view controller for UIMainStoryboardFile 'MainStoryboard' - perhaps the designated entry point is not set?

这个问题的原因应该是在你的StoryBoard中没有一个view controller设置了Initial Scene。您需要选择一个view conroller作为story board的第一个界面:

解决:

在故事面板中选中视图,在其属性检查器中找到Initial Scene项的 Is Initial View Controller复选框,勾上就能使程序打开时进入该视图。一般后建的故事面板都不会默认选中该选项


二、Storyboard没有和viewController绑定

<span style="font-size:18px;">-(void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender{
    
    NSLog(@"prepareForSegue");
    if([segue.identifier isEqualToString:@"WZHPZL"]){
        NSLog(@"WZHPZL");
        WZHPZLTableViewController *hpzl = segue.destinationViewController;
        hpzl.hpzlArray = _hpzlArray;
        hpzl.delegate = self;
    }
    if([segue.identifier isEqualToString:@"WZCitys"]){
        NSLog(@"WZCitys");
        WZCitySelectViewController *vc = segue.destinationViewController;
        vc.provinceArray = _provinceArray;
        vc.delegate = self;
        return;
    }
}</span>
经过Debug定位,发现错误是在这行出错。

<span style="font-size:18px;">hpzl.hpzlArray = _hpzlArray;</span>
<span style="font-size:18px;"></pre><pre name="code" class="objc"><span style="font-size:18px;">-[UITableViewController setHpzlArray:]: unrecognized selector sent to instance 0x7be3ccb0</span>
</span>

后来发现是WZHPZLTableViewController并没有和其所对应的storyboard发生绑定造成的


三、ios模拟器中不能切换到中文输入法,没有小地球?

解决方法:

1)  模拟器打开后,按cmd+shift+h 回到模拟器主菜单

2)  模拟器中找到Settings->General->Keyboard->Keyboards->Add New Keyboard
3)  在列表中选择 中文输入法是Chinese-Simplified(PinYin)
添加完成后再进入你开发的应用,你会发现当需要输入内容时弹出的键盘上会同真实设备一样多出一个小地球可以用来切换输入法。


四、IOS中用代码创建一个button,设置Title后不能正常显示 ?

这是因为这个button设置图片时,是以SetImage的方式,正确的方式是SetBackgroundImage的方式去set背景图片,这样再设置Title时就可以正常显示了。


评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值