当前位置: 代码迷 >> 综合 >> iOS 第7课 UIImageView
  详细解决方案

iOS 第7课 UIImageView

热度:9   发布时间:2023-12-16 14:52:00.0

首先要注意的是UIImageView和UIImage是不同的

0:首先还是通过纯的代码来实现

0:删除3个文件ViewController.hViewController.mMain.storyboard

1:修改点击左边的蓝色按钮,然后选择general-》developer info-》main interface ,将这个main interface 晴空

2:然后再创建一个MainUIViewController ,它继承自UIViewController

1:AppDelegate.m的didfinshlaunchingwithoptions方法的更新

[csharp]  view plain  copy 
  
 
  1. - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {  
  2.     // Override point for customization after application launch.  
  3.     self.window = [[UIWindow alloc]initWithFrame:[UIScreen mainScreen].bounds];  
  4.     [self.window setRootViewController:[[MyUIViewController alloc] init]];//相当于是android 里面的setcontentview  
  5.     [self.window makeKeyAndVisible];  
  6.       
  7.     return YES;  
  8. }  
2: 

//
//  AppDelegate.m
//  SevenUIImageView
//
//  Created by 千雅爸爸 on 16/10/10.
//  Copyright ? 2016年 kodulf. All rights reserved.
//#import "AppDelegate.h"
#import "MainUIViewController.h"
@interface AppDelegate ()@end@implementation AppDelegate- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {// Override point for customization after application launch.//使用纯代码的方式self.window = [[UIWindow alloc]initWithFrame:[UIScreen mainScreen].bounds];[self.window setRootViewController:[[MainUIViewController alloc]init]];[self.window makeKeyAndVisible];return YES;
}- (void)applicationWillResignActive:(UIApplication *)application {// Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.// Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game.
}- (void)applicationDidEnterBackground:(UIApplication *)application {// Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.// If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
}- (void)applicationWillEnterForeground:(UIApplication *)application {// Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background.
}- (void)applicationDidBecomeActive:(UIApplication *)application {// Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
}- (void)applicationWillTerminate:(UIApplication *)application {// Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
}@end