草庐IT

dma_init_struct

全部标签

objective-c - UIViewController: [super init] 调用 [self initWithNibName bundle:]

我的UIViewController子类中有两个初始化函数:-(id)init{self=[superinit];if(self){//Customstuffreturnself;}returnnil;}和-(id)initWithNibName:(NSString*)nibNameOrNilbundle:(NSBundle*)nibBundleOrNil{self=[superinitWithNibName:nibNameOrNilbundle:nibBundleOrNil];if(self){//Customstuff}returnself;}我将init函数放入以避免调用init

ios - 在 UIView init 中添加一个 CALayer 子层

我试图在UIView子类中添加一个CALayer作为子层,但是当我在init方法中添加子层时,当我将View添加到另一个View或窗口时,我得到EXC_BAD_ACCESS。初始化方法:-(id)initWithTitle:(NSString*)titlemessage:(NSString*)message{if((self=[superinit])){self.title=title;self.message=message;self.alertLayer=[[CALayeralloc]init];self.layer.cornerRadius=kCORNER_RADIUS;self

iphone - NSMutableArray alloc init 与 NSMutableArray 数组

有什么区别:[[NSMutableArrayalloc]init]和[NSMutableArrayarray] 最佳答案 在[NSMutableArrayarray]中,您不必释放array,它会自动释放。&如果你要写[NSMutableArrayalloc]init]你将不得不释放array所以[[NSMutableArrayarray]将等同于[[[NSArrayalloc]init]autorelease]; 关于iphone-NSMutableArrayallocinit与NSM

objective-c - 将 Objective-C 指针类型 'NSString *' 转换为 C 指针类型 'CFStringRef'(又名 'const struct __CFString *')需要桥接转换

将Objective-C程序转换为Objective-CARC时,出现错误:"castofObjective-Cpointertype'NSString*'toCpointertype'CFStringRef'(aka'conststruct__CFString*')requiresabridgedcast"代码如下:-(NSString*)_encodeString:(NSString*)string{NSString*result=(NSString*)CFURLCreateStringByAddingPercentEscapes(NULL,(CFStringRef)string,

ios - 使用参数创建自定义 UIView init 方法

我正在寻找如何使用传入参数的自定义init方法正确子类化UIView。我已阅读此处的UIView类引用文档:https://developer.apple.com/library/ios/documentation/uikit/reference/uiview_class/uiview/uiview.html目前UIView是在UIViewController中创建的,可以移动/重构到它自己的子类中。此外,目前View完全在代码中创建,框架由添加到View本身的约束计算。文档说明如下initWithFrame:-Itisrecommendedthatyouimplementthisme

ios - 将 NSString 转换为 NSAttributedString 无需 alloc init

我想将NSString转换成NSAttributedString。但我总是要做NSAttributedString*useDict1=[[NSAttributedStringalloc]initWithString:@"String"];有没有其他方法可以让我不必每次都分配Dictionary,而只需提供字符串? 最佳答案 我建议在NSString上创建一个类别,使用一种将其转换为NSAttributedString的方法,然后在您的项目中使用该辅助方法。像这样:@interfaceNSString(AttributedString

iphone - 当我初始化自定义单元格时返回 'self' 而它没有设置为 '[(super or self) init...]' 的结果

在CustomCell.m中,我定义了我想从IB加载单元格的init方法:-(id)init{self=[superinit];if(self){NSArray*nib=[[NSBundlemainBundle]loadNibNamed:@"CustomCell"owner:selfoptions:nil];self=[nibobjectAtIndex:0];}returnself;}在MyTableViewController.m的cellForRowAtIndexPath方法中,我初始化了我的自定义单元格-(UITableViewCell*)tableView:(UITableVi

ios - 调用 alloc init 时 UIImagePickerController 真的很慢

我有一个ViewController,它在按下tabBarController中的一个选项卡时显示。在这个ViewController中,我在viewDidLoad方法中初始化了一个UIImagePickerController:-(void)viewDidLoad{[superviewDidLoad];//SetimagePicker//-------------------------//_imagePicker=[[UIImagePickerControlleralloc]init];_imagePicker.delegate=self;_imagePicker.videoMax

STM32 DMA1和DMA2通道一览表、STM32F103C8T6定时器通道对应的引脚

TIM1_BRK_IRQn       =24,   TIM1_UP_IRQn        =25,   TIM1_TRG_COM_IRQn     =26,  TIM1_CC_IRQn        =27,  TIM2_IRQn         =28,  TIM3_IRQn         =29,  这个函数TIM_SetCompare1,这个函数有四个,分别是TIM_SetCompare1,TIM_SetCompare2,TIM_SetCompare3,TIM_SetCompare4。位于CH1那一行的GPIO口使用TIM_SetCompare1这个函数,位于CH2那一行的GPIO

ios - swift : Calling an init from another init

我有一个带有两个初始化方法的对象。其中一个接受NSDictionary,另一个接受一大堆String变量。我想调用NSDictionaryinit,然后从那里将我的字典转换为字符串,然后用我的字符串调用另一个init。这是我的代码:init(data:NSDictionary){self=Event(data["event_id"]as!String,eventName:data["event_name"]as!String,eventDescription:data["description"]as!String,eventCategories:data["categories"]a