English 中文(简体)
Is it possible to access a UITableView s ScrollView In Code From A Nib?
原标题:

Right now I am creating a UITableView in a FlipsideView nib. I don t seem to be able to change the background of the table view from within interface builder. I can fix this by creating an outlet and then setting the background. However, I want to give the scroll view rounded corners in order to create a look similar to the iPhone weather/stock app table views. Is there a way to access the scroll view s property in code so that I can set the rounded corners?

最佳回答

A UITableView doesn t have a UIScrollView, it is a UIScrollView. UITableView is a subclass of UIScrollView as can be seen it the documentation. Any properties of functionality of UIScrollView you want to access can be directly accessed via the table view.

Similarly, UITableViewDelegates are all UIScrollViewDelegates.

问题回答

You can add a corner radius to any view s layer. It would look something like this:

theTableView.layer.cornerRadius = 10.0f; // Or whatever radius you wanted to set

I believe you ll need to link to the QuartzCore framework and import the QuartzCore.h header, too.

This will round the corners of the table similar to how they appear in the flipside of Weather.app.

If I m not mistaken, the table views for the Stocks and Weather applications are simply single-section grouped table views (UITableViews initialized with the UITableViewStyleGrouped style). You shouldn t need to customize anything about the table view s UIScrollView properties to generate this same rounded-corner effect.





相关问题
Code sign Error

I have created a new iPhone application.I have two mach machines. I have created the certificate for running application in iPhone in one mac. Can I use the other mac for running the application in ...

ABPersonViewController Usage for displaying contact

Created a View based Project and added a contact to the AddressBook using ABAddressBookRef,ABRecordRef now i wanted to display the added contact ABPersonViewController is the method but how to use in ...

将音频Clips从Peter改为服务器

我不禁要问,那里是否有任何实例表明从Peit向服务器发送音响。 I m不关心电话或SIP风格的解决办法,只是一个简单的袖珍流程......

• 如何将搜查线重新定位?

我正试图把图像放在搜索条左边。 但是,问题始于这里,搜索条线不能重新布署。

热门标签