iphone - How to customize back barbutton on EKEventViewcontroller -


it tried following code segment customize bar button own button. had no effect looked default button.

    ekeventviewcontroller*eventview = [[ekeventviewcontroller alloc] initwithnibname:nil bundle:nil];     eventview.event = closestevent;     eventview.allowsediting = no;     uibutton* leftbutton = [uibutton buttonwithtype:uibuttontypecustom];     [leftbutton setimage:[uiimage imagenamed:@"closebutton.png"] forstate:uicontrolstatenormal];     leftbutton.frame = cgrectmake(0, 0, 25, 25);     [leftbutton addtarget:nil action:nil forcontrolevents:uicontroleventtouchupinside];      self.navigationitem.backbarbuttonitem = [[uibarbuttonitem alloc] initwithcustomview:leftbutton];      [self.navigationcontroller pushviewcontroller:eventview animated:yes]; 

i tried put ekeventviewcontroller child view of view controller had no clue how right. either way i'd customize button.

update, tried this:

 eventview.navigationitem.leftbarbuttonitem = [[uibarbuttonitem alloc] initwithcustomview:leftbutton]; 

works done button automatically added on right-side(may @ runtime?) tried nil right bar button had no effect:

  eventview.navigationitem.rightbarbuttonitem = nil; 

what occurring when push ekeventviewcontroller object allocated views not yet loaded. solution found using uiappearance api. try following call.

 nsdictionary *textattributes = @{nsforegroundcolorattributename: [uicolor whitecolor]};     [[uibarbuttonitem appearance] settitletextattributes:textattributes forstate:uicontrolstatenormal]; 

unfortunately affect uibarbuttonitems in app , following code not work me. may have manually set other instances of uibarbuttonitem

this code not work me

[[uibarbuttonitem appearancewhencontainedin:[ekeventviewcontroller class], nil] settitletextattributes:textattributes forstate:uicontrolstatenormal]; 

Comments

Popular posts from this blog

html5 - What is breaking my page when printing? -

c# - must be a non-abstract type with a public parameterless constructor in redis -

ajax - PHP/JSON Login script (Twitter style) not setting sessions -