Yuv*_*j.M 4 iphone select uitextview uiimageview ios
我在iPhone应用程序中工作,如iMessage本机应用程序.我设计了一个像iMessage一样的页面,并添加了一个气泡.我是怎么做的,只是添加了一个UITextView in UITableView Cell and also i have added UIImageView on UITextView with bubble images.
从NSMutableArray将文本加载到UITextView.它工作正常.现在我怀疑是:
在iMessage应用程序中,他们设置了它when the user hold the bubble they making the text as selectable and showing Copy option.在我的应用程序when the user hold a bubble the Copy option showing but some particular text only copying.如何选择所有文本并向用户显示复制选项?
在iMessage应用程序中,选择区域(选择开始和选择结束两行)未显示.但在我的应用程序中selection regions are showing how can i manage that?
你能帮我解决这个问题吗?提前致谢.
最后我解决了我在代码下面使用的问题.现在我可以从UITextView中选择所有内容并向用户显示复制选项以复制邮件.请找到供您参考的代码.
- (BOOL)canPerformAction:(SEL)action withSender:(id)sender
{
if (action == @selector(copy:))
{
[self selectAll:self];
return YES;
}
else if (action == @selector(cut:))
{
return NO;
}
return NO;
}
- (void)copy:(id)sender
{
UIPasteboard *pastBoard = [UIPasteboard generalPasteboard];
[pastBoard setString:self.text];
self.selectedTextRange = nil;
}
Run Code Online (Sandbox Code Playgroud)
快乐的编码.