- iOS/Objective-C 元类和类别
- objective-c - -1001 错误,当 NSURLSession 通过 httpproxy 和/etc/hosts
- java - 使用网络类获取 url 地址
- ios - 推送通知中不播放声音
<分区>
我的项目中有 Collectionview...它在 ipad 和 iphone 中正常工作..但在 ipod 中不行...ipod id IOS7 的版本..任何人都可以告诉我问题是什么..我必须做什么做...我的代码如下
_collectionView=[[UICollectionView alloc] initWithFrame:CGRectMake(-5, 0, self.view.bounds.size.width, height) collectionViewLayout:layout];
[_collectionView setDataSource:self];
[_collectionView setDelegate:self];
[_collectionView registerClass:[UICollectionViewCell class] forCellWithReuseIdentifier:@"cellIdentifier"];
[_collectionView setBackgroundColor:[UIColor whiteColor]];
[_collectionView setShowsHorizontalScrollIndicator:NO];
[_collectionView setShowsVerticalScrollIndicator:NO];
[self.view addSubview:_collectionView];
- (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section
{
return arrayMonths.count;
}
// The cell that is returned must be retrieved from a call to - dequeueReusableCellWithReuseIdentifier:forIndexPath:
- (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath
{
UICollectionViewCell *cell=[collectionView dequeueReusableCellWithReuseIdentifier:@"cellIdentifier" forIndexPath:indexPath];
for(UIView *subview in [cell subviews]) {
[subview removeFromSuperview];
}
MonthView *month=[arrayMonths objectAtIndex:indexPath.row];
if ([month.strMonthName isEqualToString:@"February"]) {
UILabel *label=[[UILabel alloc]initWithFrame:CGRectMake(0, -5, cell.frame.size.width, 40)];
[label setText:[NSString stringWithFormat:@"%@ - %@",[[NSUserDefaults standardUserDefaults] valueForKey:@"KiCalName"],month.strYear]];
label.textAlignment=NSTextAlignmentCenter;
[label setFont:[UIFont fontWithName:@"AmericanTypewriter-Bold" size:12.0]];
[cell addSubview:label];
[month setFrame:CGRectMake(0, 35, month.frame.size.width, month.frame.size.height)];
}else if([month.strMonthName isEqualToString:@"January"] || [month.strMonthName isEqualToString:@"March"]){
[month setFrame:CGRectMake(0, 35, month.frame.size.width, month.frame.size.height)];
}
[cell addSubview:month];
[hud hide:YES];
return cell;
}
-(void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath
{
MonthView *monthOld=[arrayMonths objectAtIndex:indexPath.row];
CGRect rectNew=CGRectMake(monthOld.frame.origin.x, monthOld.frame.origin.y, monthOld.frame.size.width+40, monthOld.frame.size.height+40);
MonthView *month=[[MonthView alloc]initWithFrame:monthOld.frame andYear:monthOld.strYear andMonth:monthOld.strMonthName andNoOfDays:monthOld.noOfDays andArrayOffDays:monthOld.arrayOFF andArrayOnDays:monthOld.arrayONN];
[month setBackgroundColor:[UIColor whiteColor]];
UIView *view=[[UIView alloc]initWithFrame:rectNew];
[view setBackgroundColor:[UIColor whiteColor]];
[month setFrame:CGRectMake(20, 20, month.frame.size.width, month.frame.size.height)];
[view addSubview:month];
[[KGModal sharedInstance] setShowCloseButton:NO];
[[KGModal sharedInstance] showWithContentView:view andAnimated:NO];
}
- (CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout*)collectionViewLayout sizeForItemAtIndexPath:(NSIndexPath *)indexPath
{
MonthView *month=[arrayMonths objectAtIndex:indexPath.row];
NSLog(@"month name %@",month.strMonthName);
NSLog(@"month %@",month);
CGSize height;
height=CGSizeMake(105, 155);
if ([month.strMonthName isEqualToString:@"January"]) {
height=CGSizeMake(105, 190);
NSLog(@"called");
}else if ([month.strMonthName isEqualToString:@"February"]){
height=CGSizeMake(105, 190);
NSLog(@"called");
}else if ([month.strMonthName isEqualToString:@"March"]){
height=CGSizeMake(105, 190);
NSLog(@"called");
}else{
}
return height;
}
-(CGFloat)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout minimumInteritemSpacingForSectionAtIndex:(NSInteger)section
{
return 1;
}
-(CGFloat)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout minimumLineSpacingForSectionAtIndex:(NSInteger)section
{
return 1;
}
我的妻子最近买了一个 nano,我想为它写一个简单的程序。看来 Apple 只发布了适用于 iPhone/iPod Touch 的 SDK,而无法针对 nano。 有哪些选项可以创建针对 nano 的
我是 iOS 开发的新手,我尝试在我的 iPod touch 2 代 (iOS 4.2.1) 上运行一个简单的 HelloWorld 应用程序。对于开发,我使用带有 Mountain Lion 和 X
我真的宁愿不购买 Mac 只是为了做到这一点。我知道已经努力使其成为可能,但很难说哪些值得我花时间。 谢谢! 最佳答案 我以前也想过这种事情……我在另一个论坛上找到了关于同一主题的帖子:http://
我只是想知道 iPod Touch 4G 是否支持低功耗蓝牙 4.0。 iOS v5.x 支持适用于 iOS 的蓝牙 LE (BLE)。那么升级到 iOS 5.x 是否会为 iPod Touch 启用
在属性部分下的CLLocation类引用内,它表示坐标: coordinate The geographical coordinate information. (read-only) @proper
我一直在尝试在 linux 上访问第 6 代 iPod nano。我试过Debian Squeeze自带的gtkpod,好像不支持第六代nano。所以我在 wine 下尝试了 iTunes,但它几乎没
我正在为 iPod 播放器 Controller 使用音乐播放器属性。 // .h @property (nonatomic, retain) MPMusicPlayerController *ipo
我正在为我的 iPod Touch 开发一款应用程序,该应用程序不使用 iPhone 特殊硬件(例如电话或摄像头)。我想在我的 iPod touch 上测试它。我已经是注册开发者(免费帐户,免费)。要
我使用 Core Graphics 开发了一个简单的绘图应用程序,您可以使用 Core Graphics 用手指在屏幕上绘图。 在第 3 代 iPod touch 上它运行非常非常流畅,但任何更好或更
我刚刚使用 PhoneGap build 创建了一个应用程序,并尝试在我的 iPod Touch 3G 设备上测试它。它说无法安装,因为它需要较新版本的 iPod 软件。我的 iPod 有 iOS 版
有人知道检测旧设备的方法吗: iPod touch 1G iPhone 2G iPhone 3G iPod touch 2G 来自较新的集合: iPhone 3GS iPod touch 3G iPa
我尝试编写 Activator 操作来更改当前歌曲评级。 我现在可以读取 MPMediaItemPropertyRating 属性并获得评级。 但是我们如何从应用程序中更改它呢? 最佳答案 您可以更改
有人有 iPhone/iPod 文件系统分析的硬数据吗?我对阅读比写作更感兴趣。 我正在考虑运行一些测试,但我想我应该检查一下是否有更聪明和/或更富有时间的人已经这样做了。 具体而言,我对许多小文件与
我正在编写一个 iPad 应用程序,它使用“Flite”文本转语音引擎来宣布特定事件。 Flite 引擎使用 AVAudioPlayer 实例在渲染后播放语音音频。为了好玩,我决定在我的应用程序中添加
我使用下面提到的代码来确定是否有“耳机”连接到iOS设备。 //find out, if any earphones are connected to the device - (BOOL)isHea
我正在为 iPod 构建一个应用程序。 运行它时, native iPod 音乐应用程序应继续在后台播放,但这并没有发生。 我认为这可能与我的应用程序播放的声音有关。为了在某个点播放短声音,我使用
我想使用 AudioFileOpenURL 或 ExtAudioFileOpenURL 播放 iPod 库中的音乐。 CFURLRef fileURL = [mediaItem valueForPro
我在我的应用程序中使用 MusicPlayerController 对象来播放音乐。我知道当它在 iphone ipod 应用程序上终止时可以继续播放我的应用程序音乐。 我该怎么做? 最佳答案 涉及到
我的应用程序在后台使用定位服务。为了减少电池消耗,我发现最好注册重要位置更改通知。它说要获得此通知设备需要手机 radio 。现在我怀疑我是否可以在 iPod 中获得重要的位置更改通知....我搜索了
我正在尝试能够通过 iPhone 的麦克风录制音频,同时从 iPod 播放音乐。 录音和播放分开进行,但如果我尝试从 iPod 播放并同时录音,录音就会停止。 顺便说一句,我并不是真的录制音频来保存声
我是一名优秀的程序员,十分优秀!