在故事板上使用 iCarousel 框架

发布于 2025-01-05 04:44:46 字数 181 浏览 3 评论 0原文

有没有人尝试过使用故事板实现 iCarousel ?我有一个现有的项目,但不确定这是否适用于故事板。有没有人成功地做到了这一点,或者提供了关于我需要在故事板项目中实现这一点的任何指示?

Has anyone tried to implement iCarousel with storyboards? I have an existing project, but not sure if this will work with Storyboards or not. Has anyone done this successfully or provide any directions on what do I need to implement this in a Storyboard project?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(8

清秋悲枫 2025-01-12 04:44:46

我必须承认,我无法弄清楚为什么 Storyboard 会给这么多使用 iCarousel 的人带来问题,但我现在在项目中包含了一个 Storyboard 示例,演示了如何正确设置它。

https://github.com/nicklockwood/iCarousel/tree/master/Examples /Storyboard%20Demo

FWIW,此示例的视图控制器代码与基本 iOS 演示相同。

I've got to admit, I can't work out why Storyboards are causing an issue for so many people using iCarousel, but I've now included a Storyboard example in the project that demonstrates how to set it up correctly.

https://github.com/nicklockwood/iCarousel/tree/master/Examples/Storyboard%20Demo

FWIW, the view controller code for this example is identical to the Basic iOS demo.

伴随着你 2025-01-12 04:44:46

是的,它适用于故事板。
它的工作方式与之前的 iOS 5 Storyboard 完全相同。

您可以在故事板中创建一个视图并将其类属性设置为“iCarousel”。

然后连接 iCarousel 委托和 dataSource 属性以指向您的视图控制器。 (不要忘记您的视图控制器必须实现 iCarouselDataSource 和 iCarouselDelegate 协议)。您也可以为 iCarousel 视图创建一个出口。

这就是您使用 Storyboard 访问和控制 iCarousel 的全部内容。

希望有帮助,
赫博贝尼西奥。

Yes, it works with storyboards.
It works exactly the same way as before iOS 5 Storyboards.

You can create a view in your storyboard and set its class property to be "iCarousel".

Then connect iCarousel delegate and dataSource properties to point to your view controller. (don't forget that your view controller must implement iCarouselDataSource and iCarouselDelegate protocols). You can create an outlet for your iCarousel view too.

Thats all for you to access and to control your iCarousel using Storyboards.

Hope it helps,
hbobenicio.

各自安好 2025-01-12 04:44:46

检查 iCarousel.m 是否位于您的应用程序目标的编译源列表中。项目>>应用程序目标>构建阶段>在 xCode 4.6.1 中编译源。

Check that iCarousel.m is in the compile sources list for your app target. Project > App Target > Build Phases > Compile Sources in xCode 4.6.1.

空宴 2025-01-12 04:44:46

因此,另一个问题是,如果将视图类更改为 iCarousel 并设置 command-b,则在编译警报“Interface Builder 文件中的未知类 iCarousel”后。来了。

不,不,iCarousel 和 Storyboard 不是一个好主意。

So, another problem is, that if a view-class was changed to iCarousel and command-b is set, after compiling the alert "Unknown class iCarousel in Interface Builder file." comes.

No, no, iCarousel and Storyboard isn't a good idea.

你又不是我 2025-01-12 04:44:46

以及解决方案:
在 Xcode 项目中创建一个新类,将其命名为“iCarousel”。通过拖放将原始类文件中的代码放入其中。

之后,它就会工作得很好。

And the solution:
Make a new Class in your Xcode-Project, name it "iCarousel". Via drag & drop put the Code from the original classfiles in there.

After that, it will work'S well.

栖迟 2025-01-12 04:44:46

我找到了解决方案。

不要通过添加类 iCarousel 来复制项目文件夹中的类。
只是参考他们。然后就可以了。

I found a solution.

Don't copy the class iCarousel in the project-folder by adding them.
Just reference to them. Then it works.

冷清清 2025-01-12 04:44:46

我遇到了一些问题,但当我将 iCarousel.m 文件拖入时,我没有将其目标成员设置为正确的值。

I was having some issues but I just hadn't set the iCarousel.m file's Target Membership to the right thing when I dragged it in.

污味仙女 2025-01-12 04:44:46

那是错误的。

我尝试在 Storyboard-Project 中实现 iCarousell,但总是出现委托和数据源错误。我认为它只适用于分离的 xib。

始终:此类与键数据源的键值编码不兼容。

That is wrong.

I've try to implement iCarousell in a Storyboard-Project and always get delegate and datasource errors. I think it only works with separated xib.

Always: this class is not key value coding-compliant for the key dataSource.'

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文