Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8787955
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T22:01:21+00:00 2026-06-13T22:01:21+00:00

after try 2 days and i’m losing my mind now… the main problem is

  • 0

after try 2 days and i’m losing my mind now… the main problem is simple.. i’ve button in uiview,, and i want to call method on uiviewcontroller … here’s the code

Uiview call headerView.h

@class HeaderView;
@protocol headerViewDelegate
- (void)tes:(HeaderView *)tes ratingDidChange:(float)rating;
@end
@interface HeaderView : UIView {
    UIButton *test;


}
@property (nonatomic,strong) UIButton *test;
@property (assign) id <headerViewDelegate> delegate;
@end

and the Headerview.M

#import "HeaderView.h"
#import <QuartzCore/QuartzCore.h>

@implementation HeaderView

@synthesize test;

- (id)initWithFrame:(CGRect)frame {

    self = [super initWithFrame:frame]; // not needed - thanks ddickison
    if (self) {
        test=[UIButton buttonWithType:UIButtonTypeRoundedRect];
        test.frame=CGRectMake(30, 10, 100,40);
        [test setTitle:@"Kampret" forState:UIControlStateNormal];
        [test addTarget:self action:@selector(testdata:) forControlEvents:UIControlEventTouchUpInside];

    }
    [self addSubview:test];
    return self;
}
- (id)initWithCoder:(NSCoder *)aDecoder {
    if ((self = [super initWithCoder:aDecoder])) {

    }
    return self;
}
- (void)dealloc {

    [super dealloc];
}
-(void)layoutSubviews{
    self.backgroundColor=[UIColor whiteColor];

    [self release]; // release object before reassignment to avoid leak - thanks ddickison
    //self = [nib objectAtIndex:0];

    self.layer.shadowColor = [[UIColor blackColor] CGColor];
    self.layer.shadowOffset = CGSizeMake(1.0, 1.0);
    self.layer.shadowOpacity = 0.40;


}
-(void)testdata:(id)sender{
    [self.delegate tes:self ratingDidChange:1.1f];

}
@end

viewcontroller.h

   #import <UIKit/UIKit.h>
    #import "HeaderView.h"

    @interface ReusableTableHeadersViewController : UITableViewController <headerViewDelegate> {
        HeaderView *header;
    }


    @property(nonatomic,strong) HeaderView *header;

    @end

viewcontroller.m

#import "viewcontroller.h"


@implementation ReusableTableHeadersViewController
@synthesize header;
@synthesize tblData, data;


// Implement viewDidLoad to do additional setup after loading the view, typically from a nib.
- (void)viewDidLoad {
    [super viewDidLoad];

    header = [[HeaderView alloc] initWithFrame:CGRectMake(0, 0, 320, 120)];
    [self.view addSubview:header];
}

- (void)didReceiveMemoryWarning {
    // Releases the view if it doesn't have a superview.
    [super didReceiveMemoryWarning];
}

- (void)dealloc {
    [super dealloc];
}
-(void)tes:(HeaderView *)tes ratingDidChange:(float)rating{
    NSLog(@"passing data==========%f",rating);
}
@end

i want to log the rating :
NSLog(@”passing data==========%f”,rating);

from method:

-(void)testdata:(id)sender{
        [self.delegate tes:self ratingDidChange:1.1f];

    }

but it show nothing… why? because i use initwithframe?

dont blame me… i’m totally newbie here 🙂

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T22:01:22+00:00Added an answer on June 13, 2026 at 10:01 pm
    You have not set delegate of headerview as view controller.
    
    - (void)viewDidLoad {
        [super viewDidLoad];
        header = [[HeaderView alloc] initWithFrame:CGRectMake(0, 0, 320, 120)];
        header.delegate = self;
        [self.view addSubview:header];
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

After reading and try'n'error for days, I´m giving up and ask for help. <
I try to get 60 days facebook access token from server side request. After
I was try Quercus these days, I want to create a java PHP integration
I've finally gotten this working after days of struggle. I've got a simple database
I have a problem I can't solve after few days of researches... I must
I am currently using two catch blocks after a try block. The first catches
I'm getting a missing template error after I try rendering a partial from a
Anyone knows why my sql query doesn't work after using a try catch function?
When try to access site i created after 3 login attempts it gives unauthorised
after 6 month of break I try to finish my first app. After I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.