在ios7中,sizeWithFont:现在已弃用。我现在如何在UIFont对象传递到替换方法sizeWithAttributes:?

I noticed that when I place a white or black UIImage into a UISegmentedControl it automatically color masks it to match the tint of the segmented control. I thought this was really cool, and was wondering if I could do this elsewhere as well. For example, I have a bunch of buttons that have a uniform shape but varied colors. Instead of making a PNG for each button, could I somehow use this color masking to use the same image for all of them but then set a tint color or something to change their actual color?

I'm an iOS developer with some experience and this question is really interesting to me. I saw a lot of different resources and materials on this topic, but nevertheless I'm still confused. What is the best architecture for an iOS networked application? I mean basic abstract framework, patterns, which will fit every networking application whether it is a small app which only have a few server requests or a complex REST client. Apple recommends to use MVC as a basic architectural approach for all iOS applications, but neither MVC nor the more modern MVVM patterns explain where to put network logic code and how to organize it in general. Do I need to develop something like MVCS(S for Service) and in this Service layer put all API requests and other networking logic, which in perspective may be really complex? After doing some research I found two basic approaches for this. Here it was recommended to create a separate class for every network request to web-service API (like LoginRequest class or PostCommentRequest class and so on) which all inherits from the base request abstract class AbstractBaseRequest and in addition to create some global network manager which encapsulates common networking code and other preferences (it may be AFNetworking customisation or RestKit tuning, if the we have complex object mappings and persistence, or even an own network communication implementation with standard API). But this approach seems an overhead for me. Another approach is to have some singleton API dispatcher or manager class as in the first approach, but not to create classes for every request and instead to encapsulate every request as an instance public method of this manager class like: fetchContacts, loginUser methods, etc. So, what is the best and correct way? Are there other interesting approaches I don't know yet? And should I create another layer for all this networking stuff like Service, or NetworkProvider layer or whatever on top of my MVC architecture, or this layer should be integrated (injected) into existing MVC layers e.g. Model? I know there exists beautiful approaches, or how then such mobile monsters like Facebook client or LinkedIn client deal with exponentially growing complexity of networking logic? I know there are no exact and formal answer to the problem. The goal of this question is to collect the most interesting approaches from experienced iOS developers. The best suggested approach will be marked as accepted and awarded with a reputation bounty, others will be upvoted. It is mostly a theoretical and research question. I want to understand basic, abstract and correct architectural approach for networking applications in iOS. I hope for detailed explanation from experienced developers.

在iOS 7中,苹果增加了一个新的默认导航行为。你可以从屏幕的左边缘滑动回到导航堆栈。但在我的应用程序中,这种行为与我的自定义左侧菜单冲突。那么,是否有可能在UINavigationController中禁用这个新手势?

我最近下载了Xcode 5 DP,在iOS 7上测试我的应用。我注意到并确认的第一件事是,视图的边界并不总是根据状态栏和导航栏调整大小。

在viewDidLayoutSubviews中,我打印了视图的边界:

{{0, 0}, {320, 568}}

这导致我的内容出现在导航栏和状态栏的下方。

我知道我可以通过获取主屏幕的高度,减去状态栏的高度和导航栏的高度来解释高度,但这似乎是不必要的额外工作。

我该如何解决这个问题?

更新:

我已经找到了解决这个问题的方法。将导航栏的半透明属性设置为NO:

self.navigationController.navigationBar.translucent = NO;

这将修复视图被框在导航栏和状态栏下面的问题。

然而,我还没有找到一个修复的情况下,当你想导航栏是半透明的。例如,在全屏查看一张照片时,我希望导航栏是半透明的,视图被框在它下面。这是可行的,但是当我切换显示/隐藏导航栏时,我经历了更奇怪的结果。第一个子视图(一个UIScrollView)每次都会改变它的边界y原点。

我正在研究iOS 7的一些新功能,并使用WWDC视频“在iOS上实现吸引人的UI”中讨论过的一些图像效果。为了在会话的源代码中产生一个模糊的效果,UIImage通过导入UIKit的category进行了扩展:

@import UIKit;

我想我在另一个视频中看到了一些关于这个的东西,但我很难找到它。我在找什么时候使用这个的背景资料。它只能用于苹果框架吗?使用这个编译器指令的好处是否足够让我回去更新旧代码?

从iOS7开始,在我的UITableView顶部有额外的空间它有一个UITableViewStyleGrouped样式。

这里有一个例子:

tableview从第一个箭头开始,有35个像素的无法解释的填充,然后绿色的头是一个由viewForHeaderInSection返回的UIView(其中section为0)。

有人能解释一下这个35像素的数量是从哪里来的吗?我如何才能在不切换到UITableViewStylePlain的情况下摆脱它?


更新(回答):

在iOS 11及更高版本中:

tableView.contentInsetAdjustmentBehavior = .never

我的应用程序背景是黑色的,但在iOS 7中,状态栏变成了透明的。所以我什么也看不见,只有角落里的绿色电池指示灯。如何将状态栏文本颜色改为白色,就像在主屏幕上一样?