- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
如果你能帮我解决问题,我将不胜感激,那么你提前致谢!
我的问题1
然后如果我不知道我是否能够改变 UIativity我还有其他错误。 .
我的错误是:'AcceptView' 没有可见的 @interface
声明选择器 presentViewController:animated:completion:
我的问题2我不知道如何更改连接按钮下方的代码
我想用这段代码连接按钮做什么?
// partager button
self.buttonshera = [[UIButton alloc] init];
[self.buttonshera setBackgroundImage:[UIImage imageNamed:@"buttonorange.png"] forState:UIControlStateNormal];
[self.buttonshera setAlpha:0.9];
[self.buttonshera.titleLabel setTextColor:[UIColor whiteColor]];
[self.buttonshera setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
[self.buttonshera.titleLabel setFont:[UIFont systemFontOfSize:11]];
[self.buttonshera setTitle:[NSLocalizedString(@"buttonshera", nil) uppercaseString] forState:UIControlStateNormal];
[self.buttonshera setFrame:CGRectMake(global.xmargin, ypositionstart + 60, global.bodywidth, 32)];
[self addSubview:self.buttonshera];
[buttonshera addTarget:self
action:@selector(didSelectShare)
forControlEvents:UIControlEventTouchUpInside];
我要连接这个
#pragma mark - Actions
- (void)didSelectShare:(id)sender {
NSMutableArray *activityItems = [NSMutableArray array];
NSString *htmlBody = @"<html><body><h1>Customized body</h1></body></html>";
// For Mail
[activityItems addObject:[WHMailActivityItem mailActivityItemWithSelectionHandler:^(MFMailComposeViewController *mailController) {
[mailController setSubject:@"Hey it's a subject!"];
[mailController setMessageBody:htmlBody isHTML:YES];
[mailController addAttachmentData:[htmlBody dataUsingEncoding:NSUTF8StringEncoding]
mimeType:@"text/html"
fileName:@"Awesome Attachment.html"];
mailController.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal;
}]];
// For texting
[activityItems addObject:[WHTextActivityItem textActivityItemWithSelectionHandler:^(MFMessageComposeViewController *messageController) {
[messageController setBody:@"My super awesome message for texting only!"];
messageController.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal;
}]];
// For everything else
[activityItems addObject:@"Some boring text that should be copied..."];
NSArray *activities = (@[
[[WHMailActivity alloc] init],
[[WHTextActivity alloc] init] // keep in mind that texting is broken on the simulator...
]);
UIActivityViewController *activityController = [[UIActivityViewController alloc] initWithActivityItems:activityItems
applicationActivities:activities];
activityController.excludedActivityTypes = (@[
UIActivityTypeAssignToContact,
UIActivityTypeMail,
UIActivityTypeMessage,
UIActivityTypePrint,
UIActivityTypeSaveToCameraRoll
]);
[self presentViewController:activityController animated:YES completion:NULL];
}
这个.h
#import <UIKit/UIKit.h>
#import "Globales.h"
#import "Tools.h"
@interface AcceptView : UIScrollView
{
Globales *global;
UITextView *descriptionView;
UIButton *startmission;
UIButton *buttonshera;
}
@property(nonatomic, retain) UITextView *descriptionView;
@property(nonatomic, retain) UIButton *startmission;
@property(nonatomic, retain) UIButton *buttonshera;
@end
这个.m
#import "AcceptView.h"
#import "WHMailActivity.h"
#import "WHTextActivity.h"
#import "WHMailActivityItem.h"
#import "WHTextActivityItem.h"
@interface AcceptView ()
@end
@implementation AcceptView
@synthesize startmission=_startmission;
@synthesize buttonshera=_buttonshera;
@synthesize descriptionView=_descriptionView;
- (id)initWithFrame:(CGRect)frame
{
self = [super initWithFrame:frame];
if (self) {
global = [Globales getInstance];
[self setShowsHorizontalScrollIndicator:NO];
[self setShowsVerticalScrollIndicator:NO];
[self setBounces:YES];
self.descriptionView = [[UITextView alloc] init];
[self.descriptionView setBackgroundColor:[UIColor clearColor]];
[self.descriptionView setOpaque:NO];
[self.descriptionView setFont:[UIFont systemFontOfSize:13]];
[self.descriptionView setTextAlignment:NSTextAlignmentJustified];
[self.descriptionView setUserInteractionEnabled:NO];
[self.descriptionView setText:[Globales getInstance].missionSelected.oneDescription];
[self addSubview:self.descriptionView];
CGFloat fixedWidth = global.bodywidth;
CGSize newSize = [self.descriptionView sizeThatFits:CGSizeMake(global.bodywidth, 1000)];
CGRect newFrame = self.descriptionView.frame;
newFrame.origin.x = global.xmargin;
newFrame.size = CGSizeMake(fmaxf(newSize.width, fixedWidth), newSize.height);
self.descriptionView.frame = newFrame;
[self performSelectorOnMainThread:@selector(load) withObject:nil waitUntilDone:YES];
}
return self;
}
- (void) load
{
int ypositionstart = self.descriptionView.frame.origin.y + self.descriptionView.frame.size.height + 10;
// Load pageContent with pageElement
TcheckitMobileBeanService_missionCustom *mission = global.missionSelected;
if(mission.onePageContentMain != nil)
{
if([mission.onePageContentMain.listPageElement count] > 0){
for(TcheckitMobileBeanService_pageElement *pageElement in mission.onePageContentMain.listPageElement){
if([pageElement isKindOfClass:[TcheckitMobileBeanService_pageElementMedia class]]){
TcheckitMobileBeanService_pageElementMedia *element = (TcheckitMobileBeanService_pageElementMedia *) pageElement;
if(element.oneMedia != nil){
CGRect frame = CGRectMake(global.xmargin, ypositionstart, global.bodywidth, 480);
UIImageView *imageView = [[UIImageView alloc] initWithFrame:frame];
[self performSelector:@selector(loadImageInBackground:withMedia:) withObject:imageView withObject:element.oneMedia];
ypositionstart = imageView.frame.origin.y + imageView.frame.size.height + 5;
}
}
if([pageElement isKindOfClass:[TcheckitMobileBeanService_pageElementText class]]){
TcheckitMobileBeanService_pageElementText *element = (TcheckitMobileBeanService_pageElementText *) pageElement;
if(element.title != nil){
UITextView *textView = [[UITextView alloc] initWithFrame:CGRectMake(global.xmargin, ypositionstart, global.bodywidth, 10)];
[textView setEditable:NO];
[textView setUserInteractionEnabled:NO];
[textView setScrollEnabled:NO];
[textView setText:element.title];
[textView setBackgroundColor:[UIColor clearColor]];
[textView setTextAlignment:NSTextAlignmentJustified];
[textView setFont:[UIFont boldSystemFontOfSize:13]];
[self addSubview:textView];
CGSize newSize = [textView sizeThatFits:CGSizeMake(global.bodywidth, 10000)];
CGRect newFrame = textView.frame;
newFrame.size = CGSizeMake(fmaxf(newSize.width, global.bodywidth), newSize.height);
textView.frame = newFrame;
ypositionstart = textView.frame.origin.y + textView.frame.size.height;
}
if(element.content != nil){
UITextView *textViewText = [[UITextView alloc] initWithFrame:CGRectMake(global.xmargin, ypositionstart, global.bodywidth, 10)];
[textViewText setEditable:NO];
[textViewText setUserInteractionEnabled:NO];
[textViewText setScrollEnabled:NO];
[textViewText setText:element.content];
[textViewText setBackgroundColor:[UIColor clearColor]];
[textViewText setTextAlignment:NSTextAlignmentJustified];
[textViewText setFont:[UIFont systemFontOfSize:13]];
[self addSubview:textViewText];
CGSize newSize = [textViewText sizeThatFits:CGSizeMake(global.bodywidth, 10000)];
CGRect newFrame = textViewText.frame;
newFrame.size = CGSizeMake(fmaxf(newSize.width, global.bodywidth), newSize.height);
textViewText.frame = newFrame;
ypositionstart = textViewText.frame.origin.y + textViewText.frame.size.height + 5;
}
}
}
}
}
// accepte button
self.startmission = [[UIButton alloc] init];
[self.startmission setBackgroundImage:[UIImage imageNamed:@"buttonorange.png"] forState:UIControlStateNormal];
[self.startmission setAlpha:0.9];
[self.startmission.titleLabel setTextColor:[UIColor whiteColor]];
[self.startmission setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
[self.startmission.titleLabel setFont:[UIFont systemFontOfSize:11]];
[self.startmission setTitle:[NSLocalizedString(@"startmission", nil) uppercaseString] forState:UIControlStateNormal];
[self.startmission setFrame:CGRectMake(global.xmargin, ypositionstart + 20, global.bodywidth, 32)];
[self addSubview:self.startmission];
// partager button
self.buttonshera = [[UIButton alloc] init];
[self.buttonshera setBackgroundImage:[UIImage imageNamed:@"buttonorange.png"] forState:UIControlStateNormal];
[self.buttonshera setAlpha:0.9];
[self.buttonshera.titleLabel setTextColor:[UIColor whiteColor]];
[self.buttonshera setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
[self.buttonshera.titleLabel setFont:[UIFont systemFontOfSize:11]];
[self.buttonshera setTitle:[NSLocalizedString(@"buttonshera", nil) uppercaseString] forState:UIControlStateNormal];
[self.buttonshera setFrame:CGRectMake(global.xmargin, ypositionstart + 60, global.bodywidth, 32)];
[self addSubview:self.buttonshera];
[buttonshera addTarget:self
action:@selector(didSelectShare)
forControlEvents:UIControlEventTouchUpInside];
}
- (void) loadImageInBackground:(UIImageView *)imageView withMedia:(TcheckitMobileBeanService_media *)media
{
[Tools saveImage:media withSuffixe:@""];
UIImage *originalImage = [UIImage imageWithContentsOfFile:media.localPath];
UIImage *scaledImage = [Tools imageWithImage:originalImage scaledToWidth:global.bodywidth];
[imageView setImage:scaledImage];
[imageView setFrame:CGRectMake(imageView.frame.origin.x, imageView.frame.origin.y, global.bodywidth, scaledImage.size.height)];
[self addSubview:imageView];
}
#pragma mark - Actions
- (void)didSelectShare:(id)sender {
NSMutableArray *activityItems = [NSMutableArray array];
NSString *htmlBody = @"<html><body><h1>Customized body</h1></body></html>";
// For Mail
[activityItems addObject:[WHMailActivityItem mailActivityItemWithSelectionHandler:^(MFMailComposeViewController *mailController) {
[mailController setSubject:@"Hey it's a subject!"];
[mailController setMessageBody:htmlBody isHTML:YES];
[mailController addAttachmentData:[htmlBody dataUsingEncoding:NSUTF8StringEncoding]
mimeType:@"text/html"
fileName:@"Awesome Attachment.html"];
mailController.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal;
}]];
// For texting
[activityItems addObject:[WHTextActivityItem textActivityItemWithSelectionHandler:^(MFMessageComposeViewController *messageController) {
[messageController setBody:@"My super awesome message for texting only!"];
messageController.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal;
}]];
// For everything else
[activityItems addObject:@"Some boring text that should be copied..."];
NSArray *activities = (@[
[[WHMailActivity alloc] init],
[[WHTextActivity alloc] init] // keep in mind that texting is broken on the simulator...
]);
UIActivityViewController *activityController = [[UIActivityViewController alloc] initWithActivityItems:activityItems
applicationActivities:activities];
activityController.excludedActivityTypes = (@[
UIActivityTypeAssignToContact,
UIActivityTypeMail,
UIActivityTypeMessage,
UIActivityTypePrint,
UIActivityTypeSaveToCameraRoll
]);
[self presentViewController:activityController animated:YES completion:NULL];
}
@end
最佳答案
presentViewController:animated:completion:
是一种仅用于 ViewControllers 的方法,您将它用于 ScrollView(AcceptView) 类,如果您想使用 AcceptView,它不是 Controller ,因此会出现错误,您必须将它作为 CustomClass 加载到 ScrollView 中,它无法显示或关闭。
关于ios - 'AcceptView' 没有可见的@interface 声明选择器 'presentViewController:animated:completion:',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24952803/
我有一个返回 future 的函数,该函数取决于要解决的回调结果: Future connectSocket(String email, String password, {Function o
我正在尝试链接两个返回 Completable 的响应式调用在 android 上使用改造: val userRequest = ... val languageRequest = ... retur
我正在尝试将一些数据保存在数据库中。对于添加方法,我使用 Completable。在我保存一个实体 - 客户之后,我想保存一个天数列表,但只有在客户被保存之后。这是我现在的代码。 mDatabaseM
我是 RxJava 的新手,遇到了以下问题: 我有两个 Completable 对象来存储一些数据。我想触发第一个,然后仅在第一个成功完成后才启动第二个。对第二个 Completable 的调用应该被
我正在尝试从两个不同的文件中读取数据,一个是 csv 格式,另一个文件是 xml 数据。使用completeFuture 我正在尝试从两个文件异步读取数据。我收到类型转换错误。请让我知道我是否遵循正确
我有以下人员类别: class Person { String name; String city; public void setInfo(PersonInformation
我正在尝试这个: var notifications = $( "#notifications" ); notifications.fadeOut("slow") .complete(func
我发现 Bash shell 支持一种不同于“传统”自动完成的自动完成类型,所有可能性都列在下一行。 使用“传统的”自动完成,如果我键入 ch 然后按 Tab 键,我会得到如下信息: $ ch cha
我是 rxjava/rxkotlin/rxandroid 的初学者。 我需要按顺序处理三个不同的异步调用。问题是第一步返回 Single ,第二个Completable第三个又是Completable
默认情况下,在 TextMate 中按 Esc 会循环执行可能的补全(除了关闭对话框之外),这可能会在文档中放入不需要的字符,特别是如果您习惯于在大多数文本编辑器中使用 Esc 作为安全键的话。 (事
我知道 pull complete 在之后到达 download complete 在生命周期中,但我有兴趣了解它们之间的区别。我尝试在互联网上搜索,但找不到任何清楚解释这些差异的内容。 最佳答案 拉
以下代码似乎永远不会工作,因为组似乎没有终止,并且 takeLast() 不知道最后是什么: observableSequence .groupBy { $0.key } .map { gro
我是 ido-mode 的忠实粉丝,以至于我想用它来做 describe-function 之类的事情或 find-tag等等,而无需编写类似“我可以在 Emacs 中搜索标签的 ido-mode-s
我们什么时候应该使用 Completable.fromAction()我们什么时候应该使用 Completable.fromCallable()是否有特定的用例 从文档看来,两者都做同样的事情,很难注
我有以下gulpfile.js,我通过命令行执行gulp消息: var gulp = require('gulp'); gulp.task('message', function() { cons
我在我的 .vimrc 文件中设置了 omnifuc : setlocal omnifunc = javacomplete#complete 然后当我编辑任何文件时出现异常: E518: Unknow
我如何将 Single 链接到 Completable,以便在 Completable 完成时订阅它? repository.downloadUser() 是 Single。 根据调试,似乎此方法中的
在bash中,默认情况下,按Tab键将显示当前目录中的所有文件和目录。例如:。Cat a将显示类似aFile.txt apples.png aDirectory/的内容。如果您随后完成了a目录,它将显
在bash中,默认情况下,按Tab键将显示当前目录中的所有文件和目录。例如:。Cat a将显示类似aFile.txt apples.png aDirectory/的内容。如果您随后完成了a目录,它将显
我错过了什么?示例使用 min.js。 bundle.min.js 有更多代码,但我找不到该额外代码的描述...... https://getbootstrap.com/docs/4.0/gettin
我是一名优秀的程序员,十分优秀!