If someone want to put the "Manage Subscriptions" button inner a long description text, as an option, we can just use UITextView's delegate to handle the NSURL interaction, it'll redirect user to App Store's subscription management view directly once user tap the "Manage Subscriptions" text.
Below is a sample code:
static NSString *const kURLOfManageSubscriptions = @"https://apps.apple.com/account/subscriptions";
- (void)setupSubviews
{
UITextView *aTextView = [[UITextView alloc] init];
aTextView.delegate = self;
aTextView.editable = NO;
aTextView.scrollEnabled = NO;
// ...
NSString *text = @"... long text contains ... Manage Subscriptions";
UIFont *textFont = [UIFont systemFontOfSize:UIFont.systemFontSize];
NSDictionary *textAttributes =
@{NSFontAttributeName : textFont,
NSForegroundColorAttributeName : UIColor.labelColor
};
NSDictionary *linkedTextAttributes =
@{NSFontAttributeName : textFont,
NSForegroundColorAttributeName : UIColor.blueColor,
NSLinkAttributeName : kURLOfManageSubscriptions
};
NSMutableAttributedString *content = [[NSMutableAttributedString alloc] initWithString:text attributes:textAttributes];
NSRange linkedTextRange = [text rangeOfString:@"Manage Subscriptions"];
[content addAttributes:linkedTextAttributes range:linkedTextRange];
aTextView.attributedText = content;
}
#pragma mark - UITextViewDelegate
- (BOOL)textView:(UITextView *)textView shouldInteractWithURL:(NSURL *)URL inRange:(NSRange)characterRange interaction:(UITextItemInteraction)interaction
{
if ([URL.absoluteString isEqualToString:kURLOfManageSubscriptions]) {
// The default interaction will redirect user to App Store's subscription
// management view directly.
// Or you can manage it by yourself here.
return YES;
} else {
return NO;
}
}