小编use*_*963的帖子

以编程方式拨打电话

如何在iPhone上以编程方式拨打电话?我尝试了以下代码但没有发生任何事情:

NSString *phoneNumber = mymobileNO.titleLabel.text;
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:phoneNumber]];
Run Code Online (Sandbox Code Playgroud)

iphone telephony objective-c phone-call ios

137
推荐指数
6
解决办法
11万
查看次数

弹出到导航控制器中的根视图

我有一个导航控制器有三个视图.我将三个视图控制器推到导航控制器的堆栈上,并希望通过单击按钮立即弹出所有推动的视图控制器.我希望能够从任何推动视图控制器做到这一点......

请你能帮助我,并指出我如何做到这一点?

uinavigationcontroller ios

10
推荐指数
1
解决办法
1万
查看次数

将NSData转换为NSDictionary

我从XML文件中获取数据,并将其存储在NSData对象中.我想将NSData转换为NSDictionary并将该数据存储在plist中.

我的代码如下:

NSURL *url = [NSURL URLWithString:@"http://www.fubar.com/sample.xml"];
    NSData *data = [NSData dataWithContentsOfURL:url]; 
    NSLog(@"%@", data);
Run Code Online (Sandbox Code Playgroud)

要转换数据,我使用:

- (NSDictionary *)downloadPlist:(NSString *)url {
    NSMutableURLRequest *request  = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:url] cachePolicy:NSURLRequestReloadIgnoringLocalCacheData timeoutInterval:10]; 
    NSURLResponse *resp = nil;
    NSError *err = nil;
    NSData *responseData = [NSURLConnection sendSynchronousRequest:request returningResponse:&resp error:&err];

    if (!err) {
        NSString *errorDescription = nil;
        NSPropertyListFormat format;
        NSDictionary *samplePlist = [NSPropertyListSerialization propertyListFromData:responseData mutabilityOption:NSPropertyListImmutable format:&format errorDescription:&errorDescription];

        if (!errorDescription)
            return samplePlist;

        [errorDescription release];              
    }

    return nil;
}
Run Code Online (Sandbox Code Playgroud)

谁能告诉我怎么做?

xml nsdictionary nsdata ios

9
推荐指数
2
解决办法
1万
查看次数

在电话联系人订单的UItableview中显示联系人

我可以从电话簿中导入联系人并在表格视图中显示它们.但我想要做的是按照电话簿订单中的顺序显示联系人.....

任何人都可以帮我怎么做,我的代码如下

self.navigationController.navigationBar.tintColor = [UIColor grayColor];
    self.title = @"iPhone Contacts";
    [super viewDidLoad];
    wantedname= [[NSMutableArray alloc] init];
    wantednumber= [[NSMutableArray alloc] init];
    ABAddressBookRef addressBook = ABAddressBookCreate();
    NSArray *thePeople = (NSArray *)ABAddressBookCopyArrayOfAllPeople(addressBook);

    NSString *name;
    for (id person in thePeople)
    {
        name = (NSString *)ABRecordCopyValue(person, kABPersonFirstNameProperty);
        NSLog(@"!!!!!! name ---> %@",name);
        ABMultiValueRef multi = ABRecordCopyValue(person, kABPersonPhoneProperty);
        int count1=ABMultiValueGetCount(multi);
        NSLog(@"%d",count1);
        if ([name length]>0 && count1!=0) 
        {
                    NSString *beforenumber = (NSString *)ABMultiValueCopyValueAtIndex(multi, 0);
            NSLog(@" contacts:%@",beforenumber );
            NSString* removed1=[beforenumber stringByReplacingOccurrencesOfString:@"-"withString:@""];
            NSString* removed2=[removed1 stringByReplacingOccurrencesOfString:@")"withString:@""];
            NSString* removed3=[removed2 stringByReplacingOccurrencesOfString:@" "withString:@""];
            NSString* …
Run Code Online (Sandbox Code Playgroud)

iphone

6
推荐指数
1
解决办法
3664
查看次数

添加按钮到ui导航控制器底栏

我可以使用以下代码取消隐藏导航控制器底栏

[self.navigationController setToolbarHidden:NO];
Run Code Online (Sandbox Code Playgroud)

但现在我想改变底栏的颜色,并在底栏上添加按钮.任何人都可以帮助我如何做到这一点是否有任何委托方法?

iphone

5
推荐指数
1
解决办法
2万
查看次数

时间四舍五入到最近的第10分钟

我使用以下功能将时间间隔四舍五入到最近的第五分钟

-(NSDate *)roundDateTo5Minutes:(NSDate *)mydate{
// Get the nearest 5 minute block
NSDateComponents *time = [[NSCalendar currentCalendar]
                                              components:NSHourCalendarUnit | NSMinuteCalendarUnit
                                              fromDate:mydate];
NSInteger minutes = [time minute];
int remain = minutes % 5;
// if less then 3 then round down
if (remain<3){
    // Subtract the remainder of time to the date to round it down evenly
    mydate = [mydate addTimeInterval:-60*(remain)];
}else{
    // Add the remainder of time to the date to round it up evenly
    mydate = [mydate addTimeInterval:60*(5-remain)];
}
return …
Run Code Online (Sandbox Code Playgroud)

objective-c

3
推荐指数
1
解决办法
2080
查看次数

从手机通讯录导入到iphone中的应用程序

我希望实现一个应用程序,以便从设备导入所有联系人,并在我的应用程序中的tableview中显示,这样做...

如果可能,任何人都可以告诉我该怎么做....

iphone

2
推荐指数
1
解决办法
748
查看次数

带有多个UIViewControllers的UIScrollView

我有一个scrollview和4个UIview控制器与xib文件现在我想添加4个viewcontrollers到scrollview

并且还为四个视图控制器启用了滚动

任何人都知道这个PLZ回答这个问题

iphone sdk

2
推荐指数
1
解决办法
4843
查看次数

在iphone中使用touch xml解析文件

<ArrayOfBar xmlns="http://schemas.datacontract.org/2004/07/BarometerModel" xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
  <Bar>
    <BarId>1</BarId>
    <BarType>Pub</BarType>
    <Location>West Ocean City</Location>
    <LocationId>1</LocationId>
    <Name>Mickey Fine Bar & Grill</Name>
    <Phone>9884020844</Phone>
    <Rating>3.50</Rating>
    <Status>Open</Status>
    <TypeId>1</TypeId>
    <Website>www.mickeyfinebar.com</Website>
  </Bar>
</ArrayOfBar>`
Run Code Online (Sandbox Code Playgroud)

如何使用touch XML解析此文件?

这是我正在使用的代码:

-(void) grabRSSFeed:(NSString *)blogAddress {

// Initialize the blogEntries MutableArray that we declared in the header
blogEntries = [[NSMutableArray alloc] init];    

// Convert the supplied URL string into a usable URL object
NSURL *url = [NSURL URLWithString: blogAddress];

// Create a new rssParser object based on the TouchXML "CXMLDocument" class, this is the
// object that …
Run Code Online (Sandbox Code Playgroud)

iphone

2
推荐指数
1
解决办法
1851
查看次数

UILabel在重新加载时不会在UITableViewCell中刷新

我将两个添加UILabels到a UITableViewCell,然后为该单元格命名和编号标签.当我重新加载数据时UITableView(无论是从表格视图添加还是删除联系人),标签中的数据都是重叠的,这意味着它不会重新加载标签,直到重新加载整个视图.

有人可以帮忙吗?

码:

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {

    static NSString *CellIdentifier = @"Cell";
    UILabel *name;
    UILabel *number;

    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
    if (cell == nil) {
        cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];

        //NSSortDescriptor *sortDescriptor = [[NSSortDescriptor alloc] initWithKey:@"name" ascending:YES];
        //      NSArray *sortDescriptors = [NSArray arrayWithObject:sortDescriptor];
        //      [sortDescriptor release];
    }
    CGRect Label1Frame = CGRectMake(10, 10, 140, 25);
    name = [[UILabel alloc] initWithFrame:Label1Frame];
    name.tag = 1;
    [name setBackgroundColor:[UIColor clearColor]];
    [cell.contentView addSubview:name];

    CGRect …
Run Code Online (Sandbox Code Playgroud)

iphone objective-c uitableview uilabel ios

1
推荐指数
1
解决办法
3248
查看次数

将NSArray元素分组为NSMutableDictionary

我有NSArray一些像以下格式的东西.

组数组是:

(
    "Q-1-A1",
    "Q-1-A9",
    "Q-2-A1",
    "Q-2-A5",
    "Q-3-A1",
    "Q-3-A8",
    "Q-4-A1",
    "Q-4-A4",
    "Q-10-A2",
    "Q-8-A2",
    "Q-9-A2",
    "Q-7-A1",
    "Q-5-A2"
)
Run Code Online (Sandbox Code Playgroud)

现在我要做的是将数组元素分组这样的东西.

1 = ( "Q-1-A1","Q-1-A9")
2 = ("Q-2-A1","Q-2-A5",) ...
10 =("Q-10-A2")
Run Code Online (Sandbox Code Playgroud)

任何人都可以帮助我如何实现这一目标.

提前致谢.

objective-c nsmutablearray ios

0
推荐指数
1
解决办法
829
查看次数