|
//
// myAskController.m
// ThePaperBase
//
// Created by YoungLee on 15/8/19.
// Copyright (c) 2015年 scar1900. All rights reserved.
//
#import "myAskController.h"
#import "myAskTableController.h"
#import "writeCommentAndAskController.h"
#import "loginHomeController.h"
#import "topicContentController.h"
#import "imageShareContent.h"
@interface myAskController ()<myAskTableDlegate,writeContentDelegate>
@property(nonatomic, strong)writeCommentAndAskController *writeCommentContentVC;
@property(nonatomic, strong)myAskTableController *askTabVC;
@end
@implementation myAskController
- (void)viewDidLoad {
[super viewDidLoad];
self.titleStr = @"我的提问";
self.askTabVC= [myAskTableController new];
self.askTabVC.delegate = self;
[self addChildViewController:self.askTabVC];
[self.view addSubview:self.askTabVC.view];
[self.askTabVC.view makeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(self.view.left);
make.right.equalTo(self.view.right);
make.top.equalTo(self.barHeight);
make.bottom.equalTo(self.view.bottom);
}];
// Do any additional setup after loading the view.
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(needrefreshNightMode:) name:REFRESHAFTERNIGHTMODE object:nil];
}
- (void)needrefreshNightMode:(id)sender{
self.askTabVC.view.backgroundColor = [UIColor colorWithHexString:BackGroundColor];
self.askTabVC.tableView.backgroundColor = [UIColor colorWithHexString:CELLBACKCOLOR];
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
- (void)dismissWriteContent:(commentAndAskType)type{
__weak typeof(self) Self = self;
[self dismissViewController:self.writeCommentContentVC animated:YES completion:^{
Self.writeCommentContentVC = nil;
}];
}
- (void)commentSuccess:(commentAndAskType)type {
__weak typeof(self) Self = self;
[self dismissViewController:self.writeCommentContentVC animated:YES completion:^{
[self.askTabVC manualRefresh];
Self.writeCommentContentVC = nil;
}];
}
#pragma mark -- myasktable delegate
-(void)presentAskToUserContent:(commentObjectVO *)commentBO{
self.writeCommentContentVC = [[writeCommentAndAskController alloc]init];
self.writeCommentContentVC.type = askForUserType;
self.writeCommentContentVC.nodeId = commentBO.contId;
self.writeCommentContentVC.delegate = self;
self.writeCommentContentVC.commentBO = commentBO;
if ([commentBO.objectType isEqualToString:@"3"]) {
self.writeCommentContentVC.commentOT = @"3";
}else{
self.writeCommentContentVC.commentOT = @"1";
}
[self presentController:self.writeCommentContentVC animated:YES completion:^{
}];
}
-(void)askPushToLoginView{
loginHomeController *vc = [loginHomeController new];
[self.navigationController pushViewController:vc animated:YES];
}
-(void)gotoTopicInfo:(TopicInfoBO *)topic creatUse:(userBO *)user{
topicContentController *contentVC = [topicContentController new];
contentVC.preTopicInfo = topic;
contentVC.creatUser = nil;
[self.navigationController pushViewController:contentVC animated:YES];
}
#pragma mark - naviBar tap gesture
- (void)tapNaviBar:(id)sender {
[self.askTabVC scrollTableViewToTop];
}
-(void)askToShare:(UIImage *)img contentBO:(contentObjectBO *)contentBO{
imageShareContent *askShareContentView = [[imageShareContent alloc]initWithFrame:CGRectMake(0,
0,
CGRectGetWidth(self.view.bounds),
CGRectGetHeight(self.view.bounds))];
askShareContentView.contentBO = contentBO;
askShareContentView.shareImg = img;
askShareContentView.baseController = self;
askShareContentView.sharestyle = shareNewsStyle;
[askShareContentView presentShareContentInView:self.view sender:nil];
}
/*
#pragma mark - Navigation
// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
// Get the new view controller using [segue destinationViewController].
// Pass the selected object to the new view controller.
}
*/
@end
|