Objective C NSString问题(Objective C NSString Problem)
我在我的progrram中有以下代码。 我试图将每个数字追加到NSString。 我在第二次附加字符串后收到错误。 错误是消息发送到解除分配的对象。 我知道这是一个内存管理问题。 我没有发布小计。 有人知道小计被解除分配的原因吗? 提前致谢。
-(IBAction)digitPressed:(UIButton *)sender { NSString *digit = [[sender titleLabel] text]; subtotal=[subtotal stringByAppendingString:digit]; NSLog(@"appended string is :%@",subtotal); } -(void)ViewDidLoad { subtotal = [[NSString alloc]init]; }
i have the below code in my progrram. i am trying to append each digit pressed to an NSString. i am getting error after the string gets appended the second time. the error is message send to deallocated object. i know this is a memory management issue. i have not released subtotal. Does anybody know why the subtotal is getting deallocated? Thanks in advance.
-(IBAction)digitPressed:(UIButton *)sender { NSString *digit = [[sender titleLabel] text]; subtotal=[subtotal stringByAppendingString:digit]; NSLog(@"appended string is :%@",subtotal); } -(void)ViewDidLoad { subtotal = [[NSString alloc]init]; }
原文:https://stackoverflow.com/questions/4487146
更新时间:2023-05-29 21:05
最满意答案
How to execute jquery inside a Modal window?
The following was the correct format.
$(document).on("click", ".get_case", function(){...})
相关问答
更多-
您可以在对话框中使用$ .post()或$ .ajax(),例如: $( "#dialog" ).dialog({ autoOpen: false, draggable: false, resizable: false, modal: true, buttons: { "Save": function() { var type = $("#type option:selected").val(); $.p ...
-
禁用浏览器滚动,而jQuery UI模态对话框打开(disable browser scrolling while jQuery UI modal dialog is open)[2022-02-19]
您不能完全禁用滚动,但您可以停止滚动鼠标滚轮和通常执行滚动的按钮。 看看这个答案 ,了解如何做到这一点。 您可以在创建事件上调用这些函数,并将所有内容返回到正常状态。 You can't disable scrolling completely, but you can stop scrolling with the mouse wheel and the buttons that typically perform scrolling. Take a look at this answer to unde ... -
如何在Modal窗口中执行jquery? 以下是正确的格式。 $(document).on(“click”,“。get_case”,function(){...}) How to execute jquery inside a Modal window? The following was the correct format. $(document).on("click", ".get_case", function(){...})
-
为什么不使用选择器来触发按钮,该按钮将在模态加载后显示复选框。 见小提琴: http : //jsfiddle.net/mdcuesta/W7E5N/24/