我在IOS Provisioning Portal中创建了几个配置文件,突然出现了一个新的配置文件,显示了"由Xcode管理"标签.这是什么?它是如何创建的?它是为了什么?
我研究手动内存管理,我想知道自动释放池何时耗尽.
有三种情况,我发现:1 - 在main.m,从应用程序运行开始,并在结束时排干,因此释放内存中的所有对象.2 - 当您手动显式创建自动释放池并将其耗尽时
第三种情况是我要求的,对我来说有点混乱.
在我研究时,自动释放对象就像C中的自动变量一样,只存在于逻辑范围内(在函数体中).因此,我想在每个函数之后都有一个隐藏的[pool drain];
但是,有人向我指出,我认为这不正确.苹果说,它在"事件"之后消失了.当用户点击按钮时,可能会发生该事件,例如重新加载表视图.
但是这些信息还不足以让人看到整体情况.你能否为我澄清一下,当一个游泳池正好用于物体时NSArray *arr = [NSArray array];?
默认情况下,当我们启动iPhone模拟器时,它只安装了很少的应用程序.是否可以在我的模拟器上安装其他系统应用程序(如手机,文本,地图等)或其他原生应用程序(如Facebook等)?
在我的项目中,我需要每分钟自动拍照.但我找不到任何解决方案.
这是我实现的代码,但它不起作用......
我使用NSTimer调用相机每4秒拍照.我只需要这个东西
//This method is all for the time setup. You can ignore it.
-(NSDate *)userInfo {
NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
[dateFormatter setDateFormat:@"yyyy-MM-dd 'at' HH:mm:ss"];
NSDate *date = [[[NSDate alloc]init]autorelease];
NSString *formattedDateString = [dateFormatter stringFromDate:date];
NSLog(@"formattedDateString: %@", formattedDateString);
return date;
}
- (void)targetMethod:(NSTimer *)theTimer {
NSDate *startDate = [self userInfo];
//newly changed lines.
UIImagePickerController *myPicker;
[myPicker takePicture];
NSLog(@"Timer started on %@", startDate);
}
- (IBAction) showCameraUI {
[NSTimer scheduledTimerWithTimeInterval:4.0
target:self
selector: @selector(targetMethod:)
userInfo:[self userInfo]
repeats:YES];
}
Run Code Online (Sandbox Code Playgroud) 这是一个工具栏项目.
以下代码在iOS 6模拟器和iOS 6设备上运行良好.
在iOS 5模拟器和iOS 5设备中忽略阴影偏移(UITextAttributeTextShadowOffset).
[_doneButton setBackgroundImage:[UIImage imageNamed:@"standardButtonImage.png"]
forState:UIControlStateNormal
barMetrics:UIBarMetricsDefault];
NSDictionary *textDic = [NSDictionary dictionaryWithObjectsAndKeys:
[UIFont fontWithName:@"Helvetica-Bold" size:15.0], UITextAttributeFont,
[UIColor whiteColor], UITextAttributeTextColor,
[UIColor blackColor], UITextAttributeTextShadowColor,
[NSValue valueWithUIOffset:UIOffsetMake(1.0,1.0)], UITextAttributeTextShadowOffset, //won't honor the offset in ios5
// it's not the font, font size, text color, background image, or order in the dictionary. Must be an Apple bug.
// also doesn't work if you specify [UIBarButtonItem appearance]
nil];
[_doneButton setTitleTextAttributes:textDic forState:UIControlStateNormal];
Run Code Online (Sandbox Code Playgroud)
有没有人有相同的经验,或者任何人都可以看到这个代码有什么问题?
我将搜索栏配置为显示结果按钮,但该按钮仅显示,直到用户输入字符.此时,"X"取消按钮取代它.因此,如果不输入字符,搜索结果集将等于整个数据集.我希望结果按钮保持在那里,所以当用户键入足够的字符以获得较小的结果集(如5或6行)时,他们可以单击结果按钮,我的代表将被调用,我可以显示那个结果集.
UISearchBar * theSearchBar = [[UISearchBar alloc]
initWithFrame:CGRectMake(0,0,700,40)];
theSearchBar.delegate = self;
theSearchBar.placeholder = @"What are you looking for?";
theSearchBar.showsCancelButton = NO; // shows up after first char typed.
theSearchBar.showsSearchResultsButton = YES; // disappears just when I need it.
Run Code Online (Sandbox Code Playgroud)
...在VC中进一步向下...此方法只能在搜索栏的输入字段为空时调用.
- (void)searchBarResultsListButtonClicked:(UISearchBar *)searchBar {
NSLog(@" searchBarResultsListButtonClicked for %@",searchBar); //
}
Run Code Online (Sandbox Code Playgroud)
建议,教程,示例代码和合理的dope-slaps欢迎.TIA -Mike
Xcode 3有一个漂亮的小部件小部件http://cagefreesoftware.com/images/splitScreenWidget.png将一个编辑屏幕分成两部分.我没有在Xcode 4中看到这一点.苹果公司是否认定我不再需要它了?;-)
我基本上是一个单人商店,跟上苹果出来的所有新东西是令人生畏的.当4.0出来时,我非常擅长iOS 3.1.3和3.2.现在有4.2和4.3,以及XCode 4,更不用说iPad了.所以我想我的问题是:其他开发人员如何优先考虑他们学习并尝试掌握的新功能?
大家好,我正在开发地图视图基础应用程序。我几乎用地图视图完成了所有事情,但我无法比较两个不同的地图视图区域并找到地图视图的新区域。例如,如果用户拖动地图,我想找出该区域发生了多少变化。
我有Xcode 4.2,我正在尝试创建一个下拉菜单.我希望下拉菜单下拉单词或数字.然后,当我从列表中选择某些内容时,我希望它出现在不同页面上的表格中.我的问题是:我怎么写这个?谢谢
我是iOS/objective-C的新手,我想知道如何构建自定义手势.特别地,如果用户轻敲屏幕的右上方并将他/她的手指沿着设备的边缘向下滑动到底部(左手侧的相同手势).我读完了这个:
但我想我无法弄清楚如何将它应用到我的具体案例中.
我接下来写.所有代码都用ARC写的
@interface MPEvent : UIImageView
@property (nonatomic, unsafe_unretained) SEL action;
@property (nonatomic, strong) id target;
@end
Run Code Online (Sandbox Code Playgroud)
选择器是以正确方式声明的吗?
在实现中,我接下来使用我的属性:
- (void)sendActionToTargetFromView:(id)view {
[target performSelector:action withObject:view];
}
Run Code Online (Sandbox Code Playgroud)
但编译器向我显示警告
警告:语义问题:PerformSelector可能导致泄漏,因为其选择器未知
如何修复此警告?
我有一个结构,我定义了一个正方形的大小(宽度,高度),我不知道为什么代码不能正常工作.这是我正在使用的代码:
.h
struct size{
int width;
int height;
};
.m
struct size a;
a.width = 508;
a.height = 686;
// I use it here.
Run Code Online (Sandbox Code Playgroud)
有任何想法吗?
ios ×7
iphone ×6
xcode ×6
objective-c ×4
api ×1
arm ×1
ios4 ×1
ios5 ×1
ios6 ×1
ipad ×1
mkmapview ×1
provisioning ×1
region ×1
simulator ×1
struct ×1
uicontrol ×1
uiimageview ×1
uipickerview ×1
uisearchbar ×1
x86 ×1
xcode4 ×1
xcode4.2 ×1