小编zhe*_*gwx的帖子

当标题在屏幕上时,IOS UICollectionView insertItemsAtIndexPaths崩溃

我有一个UICollectionView大小为非零的标题.似乎每当insertItemsAtIndexPaths调用时,如果标题在屏幕上,程序将崩溃并显示以下消息:

Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** setObjectForKey: object cannot be nil (key: <_UICollectionViewItemKey: 0xa38c910> Type = SV Kind = UICollectionElementKindSectionHeader IndexPath = <NSIndexPath 0xa38c7c0> 2 indexes [0, 0])'
Run Code Online (Sandbox Code Playgroud)

当标题大小为零时,或标题不在屏幕上时,调用insertItemsAtIndexPaths工作正常.有谁知道如何解决这一问题?谢谢!

该类是UICollectionViewController的子类.这是与UICollectionView相关的代码:

- (id)init {
  // Collection view layout
  UICollectionViewFlowLayout *layout = [[UICollectionViewFlowLayout alloc] init];
  layout.itemSize = CGSizeMake(100, 100);
  layout.headerReferenceSize = CGSizeMake(320, 50); // Left for the switch
  layout.minimumInteritemSpacing = 5;
  layout.minimumLineSpacing = 5;
  layout.scrollDirection = UICollectionViewScrollDirectionVertical;
  layout.sectionInset = UIEdgeInsetsMake(5, 5, 5, …
Run Code Online (Sandbox Code Playgroud)

crash ios uicollectionview

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

mac上的Opencv包含错误

我使用 mac 端口在我的 mac 山狮上安装了 opencv。然后我写了一个 OpenCV_util.cc 文件,它有:

#include <cv.h>
#include <cvaux.h>
#include <highgui.h>
Run Code Online (Sandbox Code Playgroud)

当我尝试用 编译它时g++ OpenCV_util.cc,出现以下错误:

OpenCV_util.h:1:16: error: cv.h: No such file or directory
OpenCV_util.h:2:19: error: cvaux.h: No such file or directory
OpenCV_util.h:3:21: error: highgui.h: No such file or directory
Run Code Online (Sandbox Code Playgroud)

然后我用

g++ OpenCV_util.cc -I /opt/local/include/opencv -L /opt/local/lib
Run Code Online (Sandbox Code Playgroud)

编译器找到了 cv.h、cvaux.h 和 highgui.h。但是,我收到以下错误:

In file included from OpenCV_util.h:1,
                 from OpenCV_util.cc:1:
/opt/local/include/opencv/cv.h:63:33: error: opencv2/core/core_c.h: No such file or directory
/opt/local/include/opencv/cv.h:64:33: error: opencv2/core/core.hpp: No such file or directory
Run Code Online (Sandbox Code Playgroud)

......(很多这样的错误)

我检查了/opt/local/include/opencv2/core/,所有文件都在那里。我认为这是因为在 cv.h …

c++ macos opencv include

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

将tap事件添加到IOS NSMutableAttributedString

我有一个NSMutableAttributedString,如"鲍勃喜欢你的照片".

我想知道我是否可以为"Bob"和"picture"添加两个不同的点击事件.理想情况下,点击"Bob"将呈现具有Bob的配置文件的新视图控制器,并且点击"图片"将呈现具有该图片的新视图控制器.我可以用NSMutableAttributedString做到这一点吗?

nsattributedstring ios

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

django mysql syncdb不在models.py中创建表

我有一台使用django的服务器.我正在尝试将我的数据库从sqlite3切换到mysql.以前用sqlite3做的一切都很好.但是,当我使用mysql做的时候

python manage.py syncdb
Run Code Online (Sandbox Code Playgroud)

我没有收到任何错误,但没有创建models.py中指定的表.仅创建以下表:

[ec2-user@domU-12-31-39-0F-D2-F3 prototype]$ python manage.py syncdb
Syncing...
Creating tables ...
Creating table auth_permission
Creating table auth_group_permissions
Creating table auth_group
Creating table auth_user_user_permissions
Creating table auth_user_groups
Creating table auth_user
Creating table django_content_type
Creating table django_session
Creating table django_site
Creating table django_admin_log
Creating table south_migrationhistory
Run Code Online (Sandbox Code Playgroud)

谁知道为什么?

mysql django

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