头文件

以此作为模板,记录于此

#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>
//this can write delegate directly,but out of the class ,can't see the class,so we add a @class
@class HWeatherManager;

@protocol HWeatherManagerDelegate <NSObject>

//use the delegate pass by value
-(void)test:(NSString *)str;

@end

@interface HWeatherManager : NSObject

@property (nonatomic,strong)UIViewController <HWeatherManagerDelegate> * delegate;
+(HWeatherManager *)defaultManager;

-(void)start;
-(void)endWeather;
@end
实现部分

#import "HWeatherManager.h"
#import "HWeatherViewController.h"

@implementation HWeatherManager

+(HWeatherManager *)defaultManager
{
    static HWeatherManager *manager=Nil;
    @synchronized(self)
    {
        if (manager==Nil) {
            manager=[[HWeatherManager alloc]init];
            [HWeatherViewController class];
        }
    }
    return manager;
}

-(void)start
{
   // [self.delegate test:@"hello"];
     NSBundle *bundle=[NSBundle bundleWithURL:[[NSBundle mainBundle]URLForResource:@"HWeatherDataLibResources" withExtension:@"bundle"]];
    UIStoryboard *storyboard=[UIStoryboard storyboardWithName:@"WeatherStoryboard" bundle:bundle];
    // NSLog(@"--%@",navigation);
    [self.delegate presentViewController:[storyboard instantiateInitialViewController] animated:YES completion:^{
        
    }];

}

-(void)endWeather
{
    UIStoryboard *storyboard=[UIStoryboard storyboardWithName:@"Main" bundle:Nil];
    [self.delegate presentViewController:[storyboard instantiateViewControllerWithIdentifier:@"endWeather"]  animated:YES completion:^{
        
    }];
 
}

@end

最新文章

  1. iOS ---Swift学习与复习
  2. oracle操作之传输表空间
  3. Chrome插件开发
  4. 设置session的生存时间
  5. C语言之宏
  6. Winform之跨线程访问控件(在进度条上显示字体)
  7. 定时执行Timer
  8. ASP.NET MVC全局观
  9. U盘启动时无USB-HDD选项的解决方案
  10. boost asio allocation
  11. Mongo C# Driver 聚合使用---深入浅出
  12. CSS3 Flex布局
  13. Android EditText常用属性
  14. java.lang.ClassCastException: cn.itcase.serviceImpl.servicestudentImpl cannot be cast to javax.servlet.Servlet
  15. 关于web.xml中配置Spring字符编码过滤器以解决中文乱码的问题
  16. warning: LF will be replaced by CRLF in ***. The file will have its original line endings in your working directory.
  17. Linux机器工作环境安装
  18. String和StringBuffer的机制差别
  19. spark on yarn,client模式时,执行spark-submit命令后命令行日志和YARN AM日志
  20. python--函数程序分析

热门文章

  1. hdu----(5055)Bob and math problem(贪心)
  2. Combinations [LeetCode]
  3. 如何在Objective-C中实现链式语法
  4. Firefox火狐Flash插件卡死问题完美解决方法(转载)
  5. 数据库索引&lt;二&gt; 补充前篇
  6. Java集合——Map接口
  7. 我的Github注册使用之旅
  8. select option居中显示
  9. 如何在 Linux 上用 SQL 语句来查询 Apache 日志
  10. Oracle select case when