#pragma mark 基本使用

本文介绍了在Objective-C项目中如何通过使用#pragmamark等标记来更好地组织和导航代码,这对于提高代码的可读性和维护性非常有帮助。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

在objective-c中定义多个类之后,会难以找到类的代码

#pragma mark 

使用这种代码可以在导航栏的文件栏查看到这一点

  • 第一种
#pragma mark -

可出现一个隔断直线

这里写图片描述
- 第二种

#pragma mark code

这里写图片描述
- 第三种

#pragma mark - code -

这里写图片描述

#pragma mark -- UIImagePickerControllerDelegate- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary<NSString *,id> *)info{ UIImage *pickImage = info[UIImagePickerControllerOriginalImage]; CIDetector *detector = [CIDetector detectorOfType:CIDetectorTypeQRCode context:nil options:@{CIDetectorAccuracy: CIDetectorAccuracyHigh}]; // 获取选择图片中识别结果 NSArray *features = [detector featuresInImage:[CIImage imageWithData:UIImagePNGRepresentation(pickImage)]]; [picker dismissViewControllerAnimated:YES completion:^{ if (features.count > 0) { CIQRCodeFeature *feature = features[0]; NSString *stringValue = feature.messageString; [self handleScanValue:stringValue]; } else { [self readFromAlbumFailed]; } }];}- (void)changeVideoScale:(AVMetadataMachineReadableCodeObject *)objc { NSArray *array = objc.corners; CGPoint point = CGPointZero; int index = 0; CFDictionaryRef dict = (__bridge CFDictionaryRef)(array[index++]); // 把点转换为不可变字典 // 把字典转换为点,存在point里,成功返回true 其他false CGPointMakeWithDictionaryRepresentation(dict, &point); NSLog(@"X:%f -- Y:%f",point.x,point.y); CGPoint point2 = CGPointZero; CGPointMakeWithDictionaryRepresentation((__bridge CFDictionaryRef)array[2], &point2); NSLog(@"X:%f -- Y:%f",point2.x,point2.y); NSLog(@"bounds:%@",NSStringFromCGRect(objc.bounds));}#pragma mark -- App 从后台进入前台- (void)appDidBecomeActive:(NSNotification *)notify { [self resumeScanning];}#pragma mark -- App 从前台进入后台- (void)appWillResignActive:(NSNotification *)notify { [self pauseScanning];}/** 恢复扫一扫功能 */- (void)resumeScanning { if (self.session) { [self.session startRunning]; [self.scannerView startLineAnimation]; }}/** 暂停扫一扫 */- (void)pauseScanning { if (self.session) { [self.session stopRunning]; [self.scannerView stopLineAnimation]; }}#pragma mark -- 扫一扫API/** 处理扫一扫结果 @param value 扫描结果 */- (void)handleScanValue:(NSString *)value { NSLog(@"handleScanValue === %@", value);}/** 相册选取图片无法读取数据 */- (void)readFromAlbumFailed { NSLog(@"readFromAlbumFailed");}- (void)didReceiveMemoryWarning { [super didReceiveMemoryWarning]; // Dispose of any resources that can be recreated.}@end12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819
04-03
#include "main.h" #include "Solinteg_init.h" #include "bootloader\IAP.h" #define BOOT_MVer 0x0001 #define BOOT_SVer 0x0000//sector A and BC,all need store this information #define cBootKeyBegin 0x7DF6 #define cBootKeyEnd 0x63A3 //---------------------------------------------- #define KEYWORD_Begin ((Uint16 *)0x086000) #define KEYWORD_End ((Uint16 *)0x0AFFEC) #define cAppKeyEnd 0x9671 #define cAppKeyBegin 0xF37C //--------------------------------------------- //sector A and BC,all need store this information #pragma DATA_SECTION(uJumpDate , "UserJumpDate"); #pragma DATA_SECTION(uJumpTime , "UserJumpTime"); #pragma DATA_SECTION(uJumpVer , "UserJumpVer"); const unsigned char uJumpDate[] = __DATE__; const unsigned char uJumpTime[] = __TIME__; const unsigned long uJumpVer[3]= {__TI_COMPILER_VERSION__,BOOT_MVer,BOOT_SVer}; //--------------------------------------------- //define Flash status mark #pragma DATA_SECTION(BootFlashBeginKey , "Flash_Begin" ); #pragma DATA_SECTION(BootFlashEndKey , "Flash_End" ); const unsigned int BootFlashBeginKey[4] = {cBootKeyBegin,BOOT_MVer,BOOT_SVer,0x0001}; const unsigned int BootFlashEndKey[4] = {cBootKeyEnd,(__TI_COMPILER_VERSION__>>16),(__TI_COMPILER_VERSION__&0xFFFF),0x1000}; #pragma DATA_SECTION(uBootDate , "UserBootDate"); #pragma DATA_SECTION(uBootTime , "UserBootTime"); const unsigned char uBootDate[] = __DATE__; const unsigned char uBootTime[] = __TIME__; extern void sIapMainTask(void); extern void sInitSCIa(void); //-------------------------------------------------------------------- #pragma CODE_SECTION(BOOTLOADER_ENTRY, "BootLoaderEnter"); asm(" .ref _clearram"); void BOOTLOADER_ENTRY(void) { asm(" LB _clearram"); } #pragma CODE_SECTION(EntryChoose, "UserBootStart"); void EntryChoose() { if((*KEYWORD_Begin == cAppKeyBegin) && (*KEYWORD_End == cAppKeyEnd)) { asm(" LB 0x86004"); } else { BOOTLOADER_ENTRY(); } } //-------------------------------------------------------------------- void main(void) { sInitCpu(); sIapMainTask(); } 解释一下每段代码的作用与含义
最新发布
07-12
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值