更新時(shí)間:2017-04-13 來(lái)源:黑馬程序員iOS學(xué)院 瀏覽量:
1 | static const NSTimeInterval kAnimationDuration = 0.3; |
1 | NSString *const UIApplicationDidEnterBackgroundNotification |
1 2 3 4 5 |
typedef enum : { CameraModeFront, CameraModeLeft, CameraModeRight, } CameraMode; |
1 2 3 4 5 6 7 |
typedef NS_ENUM(NSInteger, UIViewAnimationTransition) { UIViewAnimationTransitionNone, UIViewAnimationTransitionFlipFromLeft, UIViewAnimationTransitionFlipFromRight, UIViewAnimationTransitionCurlUp, UIViewAnimationTransitionCurlDown, }; |
1 2 |
titleLabel //表示標(biāo)題的label, 是UILabel類型 confirmButton //表示確認(rèn)的button, 是UIButton類型 |
1 2 |
if (someObject) { ... } if (!someObject) { ... } |
1 2 |
if (someObject == YES) { ...} if (someObject != nil) { ...} |
1 | result = object ? : [self createObject]; |
1 | result = object ? object : [self createObject]; |
1 2 3 4 |
NSArray *names = @[@"Brian", @"Matt", @"Chris", @"Alex", @"Steve"]; NSDictionary *productManagers = @{@"iPhone" : @"Kate", @"iPad" : @"Kamal"}; NSNumber *shouldUseLiterals = @YES; NSNumber *buildingZIPCode = @10018; |
1 | @property (nonatomic, readwrite, copy) NSString *name; |
1 | BOOL isAdult = age > 18; |
1 2 3 4 5 6 7 8 9 |
BOOL isAdult; if (age > 18) { isAdult = YES; } else { isAdult = NO; } |
1 2 3 |
if (car == Car.Nissan) or const int adultAge = 18; if (age > adultAge) { ... } |
1 2 3 |
if (carName == "Nissan") or if (age > 18) { ... } |
1 2 3 4 5 6 7 8 9 10 11 |
if ([self canDeleteJob:job]) { ... } - (BOOL)canDeleteJob:(Job *)job { BOOL invalidJobState = job.JobState == JobState.New || job.JobState == JobState.Submitted || job.JobState == JobState.Expired; BOOL invalidJob = job.JobTitle && job.JobTitle.length; return invalidJobState || invalidJob; } |
1 2 3 4 5 6 7 |
if (job.JobState == JobState.New || job.JobState == JobState.Submitted || job.JobState == JobState.Expired || (job.JobTitle && job.JobTitle.length)) { //.... } |
1 2 3 4 5 |
if (!user.UserName) return NO; if (!user.Password) return NO; if (!user.Email) return NO; return YES; |
1 2 3 4 5 6 7 8 9 10 11 12 |
BOOL isValid = NO; if (user.UserName) { if (user.Password) { if (user.Email) isValid = YES; } } return isValid; |
1 2 3 4 5 6 |
- (void)registerUser(User *user) { // to do... } |
1 2 3 4 5 6 |
- (void)registerUserName:(NSString *)userName password:(NSString *)password email:(NSString *)email { // to do... } |
1 | - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath; |
1 2 3 4 5 6 |
__weak typeof(self) weakSelf = self; dispatch_block_t block = ^{ [weakSelf doSomething]; // weakSelf != nil // preemption, weakSelf turned nil [weakSelf doSomethingElse]; // weakSelf == nil }; |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
__weak typeof(self) weakSelf = self; myObj.myBlock = ^{ __strong typeof(self) strongSelf = weakSelf; if (strongSelf) { [strongSelf doSomething]; // strongSelf != nil // preemption, strongSelf still not nil [strongSelf doSomethingElse]; // strongSelf != nil } else { // Probably nothing... return; } }; |
【AI設(shè)計(jì)】北京143期畢業(yè)僅36天,全員拿下高薪offer!黑馬AI設(shè)計(jì)連續(xù)6期100%高薪就業(yè)
2025-09-19【跨境電商運(yùn)營(yíng)】深圳跨境電商運(yùn)營(yíng)畢業(yè)22個(gè)工作日,就業(yè)率91%+,最高薪資達(dá)13500元
2025-09-19【AI運(yùn)維】鄭州運(yùn)維1期就業(yè)班,畢業(yè)14個(gè)工作日,班級(jí)93%同學(xué)已拿到Offer, 一線均薪資 1W+
2025-09-19【AI鴻蒙開發(fā)】上海校區(qū)AI鴻蒙開發(fā)4期5期,距離畢業(yè)21天,就業(yè)率91%,平均薪資14046元
2025-09-19【AI大模型開發(fā)-Python】畢業(yè)33個(gè)工作日,就業(yè)率已達(dá)到94.55%,班均薪資20763元
2025-09-19【AI智能應(yīng)用開發(fā)-Java】畢業(yè)當(dāng)天offer率91%,薪資1W+占比54.2%,班級(jí)均薪12k+
2025-09-19