Ios 使用hmsegmentedcontrol时标题右侧的图像

Ios 使用hmsegmentedcontrol时标题右侧的图像,ios,objective-c,Ios,Objective C,我正在使用,默认情况下,使用时图像会添加到标题的左侧: - (instancetype)initWithSectionImages:(NSArray *)sectionImages sectionSelectedImages:(NSArray *)sectionSelectedImages titlesForSections:(NSArray *)sectiontitles; 有没有办法在不分叉代码的情况下将图像添加到标

我正在使用,默认情况下,使用时图像会添加到标题的左侧:

- (instancetype)initWithSectionImages:(NSArray *)sectionImages
                sectionSelectedImages:(NSArray *)sectionSelectedImages 
                    titlesForSections:(NSArray *)sectiontitles;

有没有办法在不分叉代码的情况下将图像添加到标题右侧?

sectionTitles可以是AttributedString数组。这些可以包含图像附件。通过这种方式,您可以使用
NSAttributedString
api在标题中的任何位置或其后面创建图像

免责声明:请看一下代码

但是
因为尝试它会导致崩溃,这似乎不是在所有情况下都有效。我不认为有什么办法,但分叉

谢谢你的关注。。尽管如此,sectionTitles是一个数组。。它似乎假设了一个字符串数组。所以,当我尝试在使用了SizeWithatAttributes等的地方崩溃时,至少在某些地方,它专门检查NSString或NSAttributedString。